是否有人知道爲什麼,如果我做「drawStock =「drawStock」像Angularjs - 屬性等於值
<tr ng-repeat="icl in ic.internal_consumption_lines" drawStock="drawStock(locator_id, product_id)" ...></tr>
然後在我的劇本
scope: {
...
drawStock: "&",
...
},
template:{
...
<span>{{drawStock({locator_id:ic.internal_consumption_lines[index].transaction.locator.id, product_id:ic.internal_consumption_lines[index].transaction.product.id})}}</span>
...
...
$scope.drawStock = (lid, pid) ->
for i of $scope.product_stocks
if $scope.product_stocks[i].locator_id == lid
if $scope.product_stocks[i].product_id == pid
return $scope.product_stocks[i].stock
的drawStock功能將不顯示股票,但如果我改變的屬性爲不同的名稱比值,讓我們說像'drawstock =「drawStock(...'它的工作原理...:
<tr ng-repeat="icl in ic.internal_consumption_lines" drawstock="drawStock(locator_id, product_id)" ...></tr>
然後在我的劇本
scope: {
...
drawstock: "&",
...
},
template:{
...
<span>{{drawstock({locator_id:ic.internal_consumption_lines[index].transaction.locator.id, product_id:ic.internal_consumption_lines[index].transaction.product.id})}}</span>
...
...
$scope.drawStock = (lid, pid) ->
for i of $scope.product_stocks
if $scope.product_stocks[i].locator_id == lid
if $scope.product_stocks[i].product_id == pid
return $scope.product_stocks[i].stock
有什麼區別上面的片段和下面的片段之間?它們看起來和我完全一樣...... – gkalpak
drawStock =「drawStock vs drawstock =」drawStock,看大寫字母「S」,它使屬性和值之間有所區別。 – tomascharad