Could not find property 'link_to' on object (generated application controller).

假装没事ソ 提交于 2019-12-11 11:38:39

问题


I have a simple index.html with an application template that includes:

<script type="text/x-handlebars">
    <nav>
      <ul>
         <li>
           <h1>{{#link_to 'index'}}Bookmarker{{/link_to}}</h1>
         </li>
         <li>
            {{#link_to 'bookmarks'}}Bookmarks{{/link_to}}
         </li>
      </ul>
    </nav>

   {{outlet}}
</script>

Otherwise my ember code is:

App = Ember.Application.create();

App.Store = DS.LSAdapter;

App.Router.map(function(){
    this.resource('bookmarks');
});

when running this in the browser I get:

DEBUG: ------------------------------- ember-1.2.0.js:3231
DEBUG: Ember      : 1.2.0 ember-1.2.0.js:3231
DEBUG: Ember Data : 1.0.0-beta.4+canary.e7996c4d ember-1.2.0.js:3231
DEBUG: Handlebars : 1.1.2 ember-1.2.0.js:3231
DEBUG: jQuery     : 1.10.2 ember-1.2.0.js:3231
DEBUG: ------------------------------- ember-1.2.0.js:3231
event.returnValue is deprecated. Please use the standard event.preventDefault() instead. jquery-1.10.2.js:5374
Uncaught Error: <(subclass of Ember.View):ember258> Handlebars error: Could not find property 'link_to' on object (generated application controller). 

回答1:


I'm an idiot. Use {{#link-to}}



来源:https://stackoverflow.com/questions/20347089/could-not-find-property-link-to-on-object-generated-application-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!