Angular Ng-repeat

Source: Internet
Author: User

in angular 1.3.0 u has to does like below, Because Global controllers were disabled in 1.3.0-beta.reference


<div id= "Tableafs" ng-app= "myApp" ng-controller= "PersonController" >
<table class= "Alldiv" ng-repeat= "Item in Items" >

<td>{{$index + 1}}</td>
<td>{{item.name}}</td>
<td>{{item.price | currency}}</td>
<td><input ng-model= "Item.quantity" ></td>
<td>{{item.quantity * item.price | currency}}</td>
<td>
<button ng-click= "Remove ($index)" >Remove</button>
</td>

</table>

<script>
var app = Angular.module ("myApp", []);

App.controller (' PersonController ', function ($scope) {
$scope. FirstName = "David";

$scope. LastName = "Silva";

$scope. Items = [

{name: "Zhou Rapoo (Rapoo) V500 mechanical game keyboard Mechanical Yellow axis", quantity:1, price:199.00},
{name: "Zhou Rapoo (Rapoo) V20 optical Game Mouse Black Flame version", Quantity:1, price:139.00},
{Name: "Angularjs authoritative tutorial", Quantity:2, price:84.20}
];

})
</script>

It also said that you can get the older behavior by using below code, but It's not recomended

<div ng-app= "myApp" ng-controller= "PersonController" >

var app = Angular.module ("myApp", []). config ([' $controllerProvider ', function ($controllerProvider) {
$controllerProvider. Allowglobals ();
}]);

function PersonController ($scope) {
$scope. FirstName = "David";
$scope. LastName = "Silva";
}

Angular Ng-repeat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.