0
親関数をバインドするコンポーネントがあります。私は引数として非プリミティブな値を使わなければならないが、私はまだ定義されていないことを知っている。どうしたの ?ここに私の問題を示すサンプルコードがあります。角度コンポーネントの親関数未定義の引数
コンポーネント:
app.component('testComponent', {
template:'<button ng-click="$ctrl.hasStatus({val:700})">Test</button>',
bindings:{
hasStatus:'&'
},
controller:function() {
var ctrl = this;
}
})
親:
<test-component has-status='hasStatus(statusObj)'></test-component>
とコントローラで
:$scope.hasStatus = function(obj) {
console.log(obj) // undefined
}
そして、あなたの持っているステータス属性functioとしてplunker