Angular structure de base
by Zineb ERRAHMOUNI
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.js"></script>
<div data-ng-controller="myctrl">
<br/>
<input type="text" ng-model="myVar" />
<button type="button" data-ng-click="addTask(task)" data-ng-model="task" >add task</button>
<div data-ng-repeat="taskkey in tasks">
<label ng-model="taskkey"> {{taskkey}} </label>
<input ng-checked="taskkey" type="checkbox" name="" />
</div>
</div>
JavaScript
"use strict";
(function() {
angular.module("myApp", []);
angular.module("myApp").controller('myctrl', ['$scope', function ($scope) {
$scope.task = {};
$scope.tasks = ["stopped","run"];
function addTask(){
tasks.push(task);
}
}]);
})();