angularjs - contact list in angular js working in older version not in new version -



angularjs - contact list in angular js working in older version not in new version -

i new angular js , learning site. here trying same contact list

it working fine older version angular js ver 1.1.1. when trying using 1.3.1 not working

here fiddle link

<div ng-app="" ng-controller="contactcontroller"> <p>enter email address in below textbox , press add together button:</p> <input type="text" ng-model="newcontact" placeholder="email" /> <button ng-click="add()">add</button> <h2>contacts</h2> <ul> <li ng-repeat="contact in contacts">{{ contact }} </li> </ul> </div> <script> function contactcontroller($scope) { $scope.contacts = ["maha@gmail.com", "hello@email.com"]; $scope.add = function () { $scope.contacts.push($scope.newcontact); $scope.newcontact = ""; } } </script>

but not new version of angularjs. help me why above not working new version.

thanks in advance

just define controller under angular's module, like:

angular.module("myapp",[]) .controller("contactcontroller" , function($scope) { // ... });

working fiddle: http://jsfiddle.net/aldjj/1657/

angularjs

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -