<!--form.html--><! doctype html>
/*style.css*/.container {margin-top:40px;}. Glyphicon {padding-top:8px;}. Glyphicon-remove {color:red;}. Glyphicon-ok {color:green;}. Info-block {padding-left:0px;}
controllers.jsangular.module (' Firstmoudule ', []) .service (' Hobbydataservice ', function () { return { hobbies: [1, 3] } }) .controller (' FirstController ' , [' $scope ', ' Hobbydataservice ', function ($scope, hobbydataservice) { $scope .hobbies = [{ id: 1, name: ' Coding ' }, { id: 2, name: ' Soccer ' &Nbsp; }, { id: 3, name: ' reading ' }, { id: 4, name: ' sleeping ' }]; $scope .hobbydata = hobbydataservice; $scope. Togglehobbyselection = function (ID) { var index = $scope. HobbyData.hobbies.indexOf (ID); if (index === -1) { $scope. HobbyData.hobbies.push (ID); } else { $scope. HobbyData.hobbies.splice (index, 1); } console.log ($scope. hobbydata.hobbies); } }]);
Page effects
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6F/4C/wKioL1WYDZyzSJhNAAEwjJefuQE608.jpg "title=" View.png "alt=" Wkiol1wydzyzsjhnaaewjjefuqe608.jpg "/>
ANGULARJS Form Validation Operation example sharing