vendredi 3 février 2017

AngularJS ng-true-value not working on v1.6.1

So I am new to AngularJS and I was following a tutorial online where they give the following example on how to use ng-true-value and ng-false-value:

<!DOCTYPE html>
<html lang="en">
 <head>
  <script src="http://ift.tt/1m5Pt4q"></script>
 </head>
 <body ng-app="app" ng-controller="appCtrl as vm">
  <p>
   <input type="checkbox" ng-model="vm.bw" ng-true-value="on" ng-false-value="off" />
    status: 
  </p>  
  <script>
   var app = angular.module("app", [])
   app.controller("appCtrl", function(){
    var vm = this   
   });
  </script>
 </body>
</html>

This works perfectly. But the I realized they were using an old version of AngularJS (1.2.24), so I decided to change it to the current version (1.6.1) by simply changing the line

<script src="http://ift.tt/1m5Pt4q"></script>

to

<script src="http://ift.tt/2ky3EUb"></script>

(Of course I checked if this file existed) It turns out that this example doesn't work anymore. I click the checkbox but nothing happens. Is there a working code for version 1.6.1?

Thank you in advance




Aucun commentaire:

Enregistrer un commentaire