我想在灰燼上使用angular-filemanager插件並且一直沒有成功。我在stackoverflow上發現了這個問題,它說如何在Ember裏面運行一個角度指令,但是它沒有多大幫助。灰燼如何運行角度指令和如何導入角度
Run an angular directive inside other javascript framework template
import Component from 'ember-component';
import angular from 'angular';
export default Component.extend({
didInsertElement: function() {
debugger;
let model = this.get('model');
angular.module('myapp', []).directive('somedirective', function() {
return { template: 'test {{ model[0] }} test' };
}).run(function($rootScope){ $rootScope.model = model; });
angular.bootstrap(this.element, ['myapp']);
}
});
我安裝角度與bower install --save angular
,並試圖將其導入像上面的代碼,但它不工作。我是否需要從ember-cli-build.js
文件或類似的文件導入它?
另外,有人請向我解釋這段代碼在做什麼?我認爲它是創建一個角度模塊,當使用該組件時返回該模板..所以,我只是調用該組件,它可以在組件沒有模板的情況下工作?像{{component-name model=model}}
?
我想你需要看看https://github.com/miguelcobain/ember-paper。 –