呈现模板后调用Ember.js函数

呈现模板后调用Ember.js函数,ember.js,Ember.js,我正在使用Ember.js构建一个应用程序,它将显示一张地图。为了显示地图,我需要在渲染map div之后调用一些JS 结构布局: - app/router.js --> this.route('map') - app/controllers/map.js --> build function - app/templates/map.hbs --> <div id="map"/> 在jquery中,我将使用准备好启动JS代码的文档: $handler 我想我应该使

我正在使用Ember.js构建一个应用程序,它将显示一张地图。为了显示地图,我需要在渲染map div之后调用一些JS

结构布局:

- app/router.js
--> this.route('map')
- app/controllers/map.js
--> build function
- app/templates/map.hbs
--> <div id="map"/>
在jquery中,我将使用准备好启动JS代码的文档:

$handler


我想我应该使用一个视图和一个回调函数,比如.on'didInsertElement',但我无法让管道正常工作…

好的,我加了一杯咖啡,答案出来了

您需要将视图链接到模板。以下是新的结构布局:

- app/router.js
--> this.route('map')
- app/controllers/map.js
--> build function
- app/templates/map.hbs
--> <div id="map"/>
app/router.js 这是路线图 app/controllers/map.js app/templates/map.hbs {{view id=map}} app/views/map.js 在'didInsertElement'上生成函数{} 实际上,模板渲染的控制是在视图层而不是控件中完成的。据我所知,控制器是为用户交互而设计的