You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the $index in the remove function ,which cannot define as the current index in the ng-repeat array. In the console, when i try to find out the current index, it show undefined.
why?
js:
var myApp=angular.module('app1',[]);
myApp.factory('Data', function(){//this is the set up ofthe service.
the $index in the remove function ,which cannot define as the current index in the ng-repeat array. In the console, when i try to find out the current index, it show undefined.
why?
js:
var myApp=angular.module('app1',[]);
myApp.factory('Data', function(){//this is the set up ofthe service.
]
return items;
})
myApp.controller('Ctrl_1', function($scope, Data){
$scope.items=Data;
$scope.createNewItem=function (a,b,c){
var index=$scope.items.length;
index=index++;
})
myApp.controller('Ctrl_2',function($scope, Data){
$scope.items=Data;
});
html:
<title>Angular test 1</title><!doctype html>
{{item.name}}
Quantity: {{item.quality}}
RemoveUnit Price: {{item.unitPrice}}
Total: {{item.unitPrice*item.quality | currency}}
The text was updated successfully, but these errors were encountered: