I'm using the ember-rails gem and following along with the starter screencast on the Emberjs.com site. When I create this link
<li>{{#link-to 'about'}} About {{/link-to}}</li>
It's giving me this error
Uncaught Error: Handlebars error: Could not find property 'link-to' on object <(generated application controller):ember280>.
There's a StackOverflow question that deals with this issue Helpers not properly defined in application template?. One answer says that
When you use Handlebars.compile it uses the handlebars script instead
of the Ember script. Ember has its own handlebars object that extends
the original Handlebars object with extra templates.
and gives this example
Ember.TEMPLATES["application"] = Ember.Handlebars.compile("{{#linkTo 'dashboard'}}Dashboard{{/linkTo}}")
However, I'm unclear where to put that code, and would it need to be done for every link?
I suspect you're running an older version of ember. Try running this to get the latest version of Ember into your app.
rails generate ember:install --head
Related
I've inherited an Ember application at v1.8.1. I have successfully upgraded the application to v.1.9.1, and would like to continue to update it to at least v1.13.8.
In my v1.10.1 build, it appears that the ember-template-compiler is not quite meshing with Ember and am getting the following errors in the console:
Uncaught SyntaxError: Unexpected token export
Uncaught TypeError: Cannot read property 'name' of undefined
The line erroring for the 'name' error is:
set(appController, 'currentRouteName', infos[infos.length - 1].name);
infos is empty... so it doesn't have an object to call name on.
I'm looking for some direction in how to better track down the error, and what needs to be done to successfully upgrade.
The project is using broccoli (but not ember cli), so i'm trying to make the ember-cli-htmlbars plugin work.
Is there a better way to compile HTMLBars for Ember v1.10.1?
Should I transition the project over to Ember cli?
Please let me know what code you need would need to see.
I am having an issue with the HandlebarsHelper compiled templates on an MVC5 site. Here is the code for the BundleConfig:
bundles.Add(new Bundle("~/bundles/templates", new HandlebarsTransformer())
.IncludeDirectory("~/App/templates", "*.hbs", true));
This was working fine locally and then I pushed to a server hosting the QA environment and I was getting an assembly reference error saying the HandlebarsHelper plugin was calling Jurassic 2.1.0.0 and it wasn't found. So I added Jurassic through Nuget, since then the templates stopped working. I get this error from the browser:
Chrome:
Uncaught TypeError: undefined is not a function
Firefox:
TypeError: templateSpec.call is not a function
This is happening in the following section of handlebars.js:
return function(context, options) {
options = options || {};
var namespace = options.partial ? options : env,
helpers,
partials;
if (!options.partial) {
helpers = options.helpers;
partials = options.partials;
}
var result = templateSpec.call(
container,
namespace, context,
helpers,
partials,
options.data);
if (!options.partial) {
env.VM.checkRevision(container.compilerInfo);
}
return result;
};
I am running:
Ember 1.7.0
Ember-Data 1.0.0-beta.11
Handlebars 1.3.0
JQuery 2.1.1
MVC 5
.Net 4.5.2
I have been searching online all morning and not found any answers yet that have worked, I tried removing the Jurassic Nuget package and it did not help. Any ideas would be appreciated, let me know if there is any other info that would help diagnosing the issue.
You're on a version of HandlbarsHelper that's not supported for that version of Ember.js.
There was a breaking change for version 1.9 which added support for handlebars version 2.0. This is supported in HandlebarsHelper v2.0+. As a breaking change it means 2.0+ can't be used with Ember.JS < v1.9 and Handlebars < v2.0.
The reason why it was probably working initially was because in debug templates are usually just injected into the page unminified.
Easy fix is to use HandlebarsHelper v1.1 (https://www.nuget.org/packages/HandlebarsHelper/1.1.0)
The problem was I was using a version of Handlebars Helper that only supported handlebars 2.x. Found the issue in Nuget and changed it to a different version, everything works now. Thanks for the comments.
After installing ember-components via bower, I'm trying to use it;
depending on the component I get different errors;
for example if I try to use the tab component (simple version), I get this:
Assertion Failed: `blockHelperMissing` was invoked without a helper name, which is most likely due to a mismatch between the version of Ember.js you're running now and the one used to precompile your templates. Please make sure the version of `ember-handlebars-compiler` you're using is up to date.
Error: Assertion Failed: `blockHelperMissing` was invoked without a helper name, which is most likely due to a mismatch between the version of Ember.js you're running now and the one used to precompile your templates. Please make sure the version of `ember-handlebars-compiler` you're using is up to date.
With other components (such as accordion) I get errors like this:
Uncaught Error: <App.ItaHomeView:ember360> Handlebars error: Could not find property 'em-accordion' on object <App.HomeController:ember408>.
I'm using Ember 1.7.0, with handlebars 1.3.0 and ember-components 0.2.0
Can anyone please explain what I am doing wrong?
I try to update https://github.com/trek/ember-todos-with-build-tools-tests-and-other-modern-conveniences
with the newest versions of some scripts. All work except Ember (1.2.0) gives an error:
Assertion failed: Ember Handlebars requires Handlebars version 1.0 or 1.1. Include a SCRIPT tag in the HTML HEAD linking to the Handlebars file before you link to Ember.
Error disappears when I activate the same script without dependencies but with
<script src="../dependencies/handlebars.js"></script>
I think question should be marked as answered. I got it work with https://github.com/gcollazo/brunch-with-ember-reloaded
I have just downloaded ember-1.0.0-pre.4.js and ember-data-latest.js and get the following error upon the initialization of the app:
Uncaught TypeError: Object Ember.Application has no method 'registerInjection'
How can I fix this?
Unfortunately ember-data-latest.js on GitHub isn't up-to-date with Ember Pre 4. You'll have to git clone the Ember DS repository, and then build them using rake.
You can find it here or the minified version from here
you can get it from http://cdnjs.com/ concretely:
//cdnjs.cloudflare.com/ajax/libs/ember-data.js/0.8.0-latest20121123/ember-data-latest.min.js
//cdnjs.cloudflare.com/ajax/libs/ember-data.js/0.8.0-latest20121123/ember-data-latest.js