ember.js - Ember - Missing helper action for HBS files -


i have written html div.

i have 2 hbs files. rendered 1 partial , other normal. not able invoke action on templates. getting missing helper error.

html:

<!doctype html> <html> <head>   <meta charset="utf-8">   <title>ember starter kit</title>   <link rel="stylesheet" href="css/normalize.css">   <link rel="stylesheet" href="css/style.css">  </head> <body>   <div id="holder">    </div>   <script src="js/libs/jquery-v1.11.1.js"></script>   <script src="js/libs/handlebars-v1.3.0.js"></script>   <script src="js/libs/ember-v1.6.1.js"></script>   <script src="js/libs/ember-data.js"></script>    <script src="js/app.js"></script> </body> </html> 

js:

var data={title: "my new post", body: "this first post!"}; function gettemplate(templatename,hbspath,type){        $.ajax({             url: hbspath, //ex. js/templates/mytemplate.handlebars             cache: true         }).done(function (src) {             if (type === "partial") {                 handlebars.registerpartial(templatename, $(src).html());             } else {                 template = handlebars.compile($(src).html());                 temp=template(data);                 $("#holder").append(temp);             }         });  }  gettemplate("dummy","/test/templates/dummy.hbs","partial"); gettemplate("dummy","/test/templates/application.hbs");   app = ember.application.create({});  app.router.map(function(){   this.resource('dummy');   });   app.applicationcontroller=ember.objectcontroller.extend({   needs:['dummy'],   actions:{     refresh: function(){       alert("application template refresh");     }   } }); app.dummycontroller=ember.objectcontroller.extend({   actions:{     refresh: function(){       alert("dummy template refresh");     }   } }); 

hbs: application.hbs:

<script id="application" type="text/x-handlebars-template">     {{> dummy}} </script> 

dummy.hbs:

<script type="text/x-handlebars" data-template-name='dummy'>   <div {{action 'refresh' target="controllers.dummy"}}>     refresh   </div>   <div {{action 'refresh'}}>     refresh   </div> </script> 

the code in ur demo , code in question different. here fixed demo based on code in ur question.

fixing demo u provide may need include vanilla handlebars library ember using htmlbars built on top of handlebars bit different.

em.handlebars.compile using htmlbars compile method. you can see here.

you may need use https://github.com/rwjblue/broccoli-ember-inline-template-compiler


Comments