Comments (13)
We'll document this (along with other naming conventions) soon, but it's actually:
{{view "my-view"}}
which corresponds to a file named views/my-view.js
:)
from ember-app-kit.
Yikes, I hate hyphens. Thanks for your help.
from ember-app-kit.
hehe, well feel free to UpperCase your filenames if you prefer that (though they still need to be wrapped in strings)
from ember-app-kit.
Still not working.
Using views/some-view.js
and {{view "some-view"}}
Assertion failed: Unable to find view at path 'some-view'
With Ember.ENV.LOG_MODULE_RESOLVER = true
I see the hits and misses but some-view never reaches the resolveOther method to log either.
from ember-app-kit.
hmm, just tested and you're right. looks like it should work if you remove the hypen, though (views/someview.js
and {{view "someview"}}
. might be a bug in the resolver? (cc @stefanpenner)
from ember-app-kit.
@thomasboyt Did you try views/someview.js
with {{view "someview"}}
? It's not working for me either. It never reaches the resolveOther
method.
from ember-app-kit.
It's definitely included as it shows up here: define.registry['appkit/views/someview']
from ember-app-kit.
Can we reopen this ticket?
Check out Ember.Handlebars.get
:
var handlebarsGet = Ember.Handlebars.get = function(root, path, options) {
var data = options && options.data,
normalizedPath = normalizePath(root, path, data),
value;
// In cases where the path begins with a keyword, change the
// root to the value represented by that keyword, and ensure
// the path is relative to it.
root = normalizedPath.root;
path = normalizedPath.path;
value = Ember.get(root, path);
// If the path starts with a capital letter, look it up on Ember.lookup,
// which defaults to the `window` object in browsers.
if (value === undefined && root !== Ember.lookup && Ember.isGlobalPath(path)) {
value = Ember.get(Ember.lookup, path);
}
return value;
};
After being normalizePath
'd, the root is the controller. Since it's not on the controller, and it's not a global path, the search ends here as far as I can tell.
This ghetto hackery lets this specific view resolve to prove it exists and can be looked up: (though not a real fix for obvious reasons)
window.unknownProperty = function (keyName) {
return Ember.Namespace.NAMESPACES_BY_ID.App.__container__.lookup('view:' + keyName.toLowerCase());
};
Adding this to Ember.Handlebars.get
also solves the issue for all lowercase, single word files:
if (value === undefined && root && root.container) {
value = root.container.lookup('view:' + path);
}
However, CamelCase or hyphen-ated file names do not work as they get transformed to under_score in the resolver but still registered in their original form. If you guys prefer to lookup registered modules with under_score case, the build process could make sure filenames are registered in that form. Along with the above change to Ember.Handlebars.get
, looking up on the container if available, this would be resolved.
Kind of surprised the default implementation of Ember.Handlebars.get
doesn't try to resolve views via container lookup already.
from ember-app-kit.
Found one of the problems. Ember rc7 does resolve views from the container, as needed, but rc6.1 is included in appkit.
@stefanpenner's commit:
Using rc7 fixes the issue with {{view "someview"}}
but doesn't fix the issue of resolveOther
expecting all registered modules to be under_score but the build process does not transform filenames into that form.
For anyone stumbling on this ticket, updating Ember to RC7 and removing the underscore(name)
call inside loader.js resolveOther()
solves this issue for me entirely, so far. (allowing you to use CamelCase, hyphen-ated, under_score, or whatever you want for filenames)
from ember-app-kit.
ah! that would explain why I couldn't reproduce your issues; I was using a fresh install w/ RC7.
that underscore call seems well intentioned (presumedly it's there so you can say {{view "SomeView"}}
and it would load views/some_view.js
) but if we keep it we definitely need to document it. thanks for looking into this :)
from ember-app-kit.
What about letting users decide their file name convention? Feels very forced for no real benefit.
On Aug 17, 2013, at 8:44 AM, Thomas Boyt [email protected] wrote:
ah! that would explain why I couldn't reproduce your issues; I was using a fresh install w/ RC7.
that underscore call seems well intentioned (presumedly it's there so you can say {{view "SomeView"}} and it would load views/some_view.js) but if we keep it we definitely need to document it. thanks for looking into this :)
—
Reply to this email directly or view it on GitHub.
from ember-app-kit.
I'm glad the rc7 addition was noticed, it (and many other related improvements) where driven directly by EAK and using EAK on real apps.
@jayphelps this may not yet be 100% accurate but the goal is to provide a default resolver that provides solid conventions and consistency. For naming throughout your project, and throughout ember. Ideally all major naming conventions (within reason) will be controlled by the resolver. This should satisfy the "you shouldn't need to concern yourself with trivial choices" and the "I want to opt back into trivial choices" requirements.
Now that I am back from vacation, I hope to finalize ^ in the next little while.
from ember-app-kit.
I have the same problem, but only in internet explorer
http://stackoverflow.com/questions/36029620/ember-unable-to-find-view-in-internet-explorer
here are versions i use:
version: 0.0.40
node: 0.12.0
npm: 1.4.29
view helper in template:
{view "wizard-menu" activeIndex=0 parameter=0}}
from ember-app-kit.
Related Issues (20)
- Does EAK Support Inheritance With Controllers? HOT 3
- Suggestion: Defer loading of JavaScript HOT 1
- Recommended Folder Structure Using EAK HOT 4
- Migrating to Ember-CLI HOT 17
- Deploying to a non-root directory HOT 3
- Trouble with NPM scripts HOT 1
- 'grunt test:server' not work HOT 1
- Extending Store In EAK HOT 4
- EAK: Where do we place {{partials}} ? HOT 2
- ./config/environment.js example HOT 7
- `Cannot find module..." HOT 3
- Migrating to Ember-CLI Screencast HOT 2
- Importing shared ES6 modules futuristically HOT 2
- Added bootstrap-sass-official, Now Can't Push to Heroku HOT 2
- Stub API not working with server:dist task
- Transition into the loading substate
- Allow Ember Init and Generate for Coffeescript HOT 1
- Production build failed (grunt:dist) on fresh clone of EAK HOT 1
- Cannot deploy the 'ember app kit' app to heroku
- Update Ember CLI Migration Guide HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-app-kit.