2016-07-29 56 views
0

我有一個角度組件,我想包括在我的頁面中。 一切正常,如果我評論/刪除綁定參數在這個組件...爲什麼?角度組件「綁定」參數有什麼問題?

(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'; 
     } 
    }); 

})(); 

如果我想使用結合參數,我得到一個錯誤:

enter image description here

鏈接到:https://docs.angularjs.org/error/ $編譯/ ISCP P0 = detailsComponent1 & P1 =值& P2 = Component1 & p3 =控制器%20bindings%20Definition

這是什麼意思?

謝謝。

+0

那麼,該模板來自MVC調用,它與該問題無關。我說,如果我刪除了綁定,那麼一切正常...... – monstro

+0

刪除'restrict:'E','以及。錯誤是因爲'value:'Component1「'使它像'value:@ Component1'或'value:= Component1' – varit05

回答

2

那麼,該錯誤是由於無效分離範圍來

當聲明隔離範圍的範圍定義對象必須在特定的格式,其與模式字符(@ & = <)開始,在此之後是可選的?,並以可選的本地名稱結束。

請在這裏找到參考鏈接:https://docs.angularjs.org/error/ $編譯/ ISCP

另外,你有內部的元件部分丟棄指向性。

restrict (restricted to elements for component)

請爲組件找到文檔在這裏:https://docs.angularjs.org/guide/component

希望它可以幫助你!

Cheers