【发布时间】:2016-05-16 14:43:58
【问题描述】:
Angular 1.5 的重大功能变化都围绕着components 的支持。
component('myComponent', {
template: '<h1>Hello {{ $ctrl.getFullName() }}</h1>',
bindings: { firstName: '<', lastName: '<' },
controller: function() {
this.getFullName = function() {
return this.firstName + ' ' + this.lastName;
};
}
});
虽然这一切都很好,但我不确定这与指令有何不同。
与传统的自定义指令相比,使用components 有什么好处? Angular 1.5 和 Angular 2 中的组件是否相同?
【问题讨论】:
标签: javascript angularjs angularjs-directive