Migration angular

Fermé
Montassir159 Messages postés 5 Date d'inscription lundi 16 mars 2015 Statut Membre Dernière intervention 25 mai 2016 - 25 mai 2016 à 11:36
Bonjour ,

je suis débutant en angular 2 j'ai un code en anular1 et je dois faire la migration a angular deux je sais que les variable locale se définissent dans le component.ts mais pour la variable parent je sais pas comment faire merci de m'aider .

code:

<!DOCTYPE html>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

<body ng-app="myApp" ng-controller="myCtrl">

<table class="table table-bordered table-hover">
<thead>
<tr>

<th>Price</th>
</tr>
</thead>
<tbody ng-init="total = 0">
<tr ng-repeat="product in products">
<td ng-init="$parent.total = $parent.total + product.montant ">{{ product.montant}}</td>
</tr>
<tr>

<td><b>{{ total }}</b></td>
</tr>
</tbody>
</table>

<script>
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
var i = 0;
$scope.products = [{
"code": "001",
"active": true,
"ponderation": true,
"formuleDeCalcul": "brut.TraitementIndiciaire",
"montant": 1152.9375
}, {
"code": "080",
"active": true,
"ponderation": true,
"formuleDeCalcul": " "
}, {
"code": "090",
"active": true,
"ponderation": true,
"formuleDeCalcul": "brut.Forfait",
"montant": 11.43,
"base": 15.24
}, {
"code": "450",
"active": true,
"ponderation": true,
"formuleDeCalcul": "brut.IndemniteSujetionSpeciale",
"montant": 94.66265763,
"nombre": 13
}]
});
</script>
</body>

</html>