0
我使用angular-js-styleguide-snippets
为Atom
,其中,当我在我的编辑输入ngcomponent
,扩展到以下结构:角度分量风格指南
(function() {
'use strict';
angular
.module('arroyo')
.component('intro', component);
/* @ngInject */
function component() {
var settings = {
template: '<h1>test</h1>',
controller: Controller,
};
return settings;
}
Controller.$inject = [];
/* @ngInject */
function Controller() {
}
})();
但是,使用上面的代码似乎并不奏效。虽然没有控制台错误,但组件本身(<intro></intro>
)不显示任何内容。经过一番摆弄周围,我发现,使用下面的作品的代码如预期:
(function() {
'use strict';
angular
.module('arroyo')
.component('intro', {
template: '<h1>test</h1>'
});
})();
有什么不对的第一个片段?