1
私が理解する限り、以下のコードでは毎回異なるインデックス値で3回パラグラフをレンダリングする必要があります。代わりに、最後のトランジションだけをレンダリングしています。何が起きてる?
const app = angular.module('app', [])
app.component('test', {
transclude: true,
controller: function($scope, $element, $transclude) {
//The transclusion should appear 3 times right? Since we're appending 3 times?
for(let index of [10, 11, 12]) {
const x = $transclude(Object.assign($scope.$new(true), {index}))
$element.append(x)
}
},
});
angular.bootstrap (document.querySelector('body'), ['app'])
<body>
<test>
<p>This is {{index}}</p>
</test>
<script src="https://code.angularjs.org/1.5.8/angular.js"></script>
</body>