我在获取要传递给我的指令的对象时遇到问题。我相信我做的事情是正确的,但是在一次又一次的尝试失败后,我必须寻求帮助。我在这里错过了什么阻止我将数组传递给我的指令?
HTML:
<div class="body">
{{orderList.length}} //shows up as 18
</div>
<queue-summary orders="orderList"></queue-summary>
Javascript:
directive('queueSummary', function () {
return {
scope: {
orders: '='
},
replace: true,
restrict: 'E',
templateUrl: '/partials/admin/bits/queue-summary.htm',
link: function (scope, element, attrs) {
console.log(scope, element, attrs); //$attrs.orders show it as the String "orderList" instead of the array
}
}
}).