-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to reference Views in Handlebars helper? #74
Comments
We'll document this (along with other naming conventions) soon, but it's actually:
which corresponds to a file named |
Yikes, I hate hyphens. Thanks for your help. |
hehe, well feel free to UpperCase your filenames if you prefer that (though they still need to be wrapped in strings) |
Still not working. Using
With |
hmm, just tested and you're right. looks like it should work if you remove the hypen, though ( |
@thomasboyt Did you try |
It's definitely included as it shows up here: |
Can we reopen this ticket? Check out 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 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 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 Kind of surprised the default implementation of |
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 For anyone stumbling on this ticket, updating Ember to RC7 and removing the |
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 |
What about letting users decide their file name convention? Feels very forced for no real benefit.
|
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. |
I have the same problem, but only in internet explorer here are versions i use: view helper in template: |
I can't seem to do a very common use case for my Ember apps:
I don't see any app kit code added to resolve these, and the AMD modules aren't appended to the application namespace obviously. My best guess is that this just isn't something appkit supports yet?
Even though I didn't think they'd work, I also tried:
The text was updated successfully, but these errors were encountered: