採用了棱角分明的對象,反應,ReactNG,我得到這個錯誤:錯誤:不確定是不是(評估 'this.props.menuOptions.map')
Error: undefined is not an object (evaluating 'this.props.menuOptions.map')
下面是代碼:
http://jsbin.com/xuranipuza/1/edit?html,js,output
採用了棱角分明的對象,反應,ReactNG,我得到這個錯誤:錯誤:不確定是不是(評估 'this.props.menuOptions.map')
Error: undefined is not an object (evaluating 'this.props.menuOptions.map')
下面是代碼:
http://jsbin.com/xuranipuza/1/edit?html,js,output
好像你缺少你的反應指令元素相對於要傳遞的propTypes
提供的屬性。因爲它,然後放在這些屬性值的手錶(reflectin g範圍屬性名稱)並相應地填充道具。
所以:
<sidebar-button menu-options="menuOptions" button-image="buttonImage"
button-image-mini="buttonImageMini" menu-option-bottom="menuOptionBottom">
</sidebar-button>
醫生說:
The reactDirective service will read the React component propTypes and watch attributes with these names. If your react component doesn't have propTypes defined you can pass in an array of attribute names to watch. By default, attributes will be watched by value however you can also choose to watch by reference or collection by supplying the watch-depth attribute. Possible values are reference, collection and value (default).
免責聲明:我沒有用之前NG反應。
啊,好吧,我想如果我把值的數組看着它自動使用它們。非常感謝。 – Noah
@Noah我在ngReact裏面進行調試,發現它遍歷列表並從屬性中讀取各自的屬性值。不用謝!! – PSL