【发布时间】:2016-12-04 13:08:02
【问题描述】:
我有一个角度组件,我想将其包含在我的页面中。 如果我在此组件中注释/删除 bindings 参数,一切正常...为什么?
(function () {
angular.module('app').component('detailsComponent1', {
templateUrl: '/RealSuiteApps/RealForm/-1/Details/Component1',
restrict: 'E',
bindings: {
value: "Component1"
},
controllerAs: 'cm',
controller: function () {
this.message = 'Hello from component1';
}
});
})();
如果我想使用 binding 参数,我得到一个错误:
链接到:https://docs.angularjs.org/error/$compile/iscp?p0=detailsComponent1&p1=value&p2=Component1&p3=controller%20bindings%20definition
什么意思??
谢谢。
【问题讨论】:
-
所以?模板来自MVC调用,与问题无关。我说,如果我删除绑定,一切都会正常...
-
同时删除
restrict: 'E',。错误是因为value: "Component1"使它像value: @Component1或value: =Component1
标签: angularjs angular-components