Sorry my mistake, I looked in the splice method and used this 
syntax $scope.list.splice(itemIndex, 1); and it worked hoorah!

On Monday, December 28, 2015 at 4:42:19 PM UTC+2, 姜信徳 wrote:
>
> You can use just `Array.splice` method. 
>
> Below is same question on Stack Overflow.
>
> http://stackoverflow.com/questions/14250642/angularjs-how-to-remove-an-item-from-scope
>
> 2015-12-28 23:32 GMT+09:00 ShatterStar <[email protected] 
> <javascript:>>:
>
>> I have a list with a delete button that is attached to each item like this
>>
>>  <table>
>>  <tr>
>>  <th>Date</td>
>>  <th>Detail</td>
>>  <th>Amount</td>
>>  </tr>
>>  <tr ng-repeat="item in list" >
>>  <td>{{item.date}}</td>
>>  <td>{{item.detail}}</td>
>>  <td>{{item.amount}}</td>
>>  <td><a class="noUnderline" href=
>> "#/editExpense/{{$index}}/{{item.date}}/{{item.detail}}/{{item.amount}}"
>> ><button>Edit</button></a></td>
>>  <td><button ng-click="deleteExpense($index)">Delete</button></td>
>>  </tr>
>>  </table>
>>
>> upon clicking the delete button I want that particular item in the object 
>> that I have declared to be removed / deleted, here's my object
>>
>>  $scope.list = [ 
>>  { date: "2015-12-01", detail: "Bought new wallet", amount: $filter(
>> 'number')(150.00 , 2) },
>>  { date: "2015-12-08", detail: "Bought shoes", amount: $filter('number')(
>> 225.36 , 2) },
>>  { date: "2015-12-12", detail: "Bought shirt", amount: $filter('number')(
>> 300.89 , 2) },
>>  { date: "2015-12-12", detail: "Paid electricity bill", amount: $filter(
>> 'number')(190.9 , 2) },
>>  { date: "2015-12-15", detail: "Paid phone account", amount: $filter(
>> 'number')(115.00 , 2) }
>>  ];
>>
>> how do I go about doing this?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "AngularJS" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to