I have this code:
<!doctype html> <html ng-app="myApp" xmlns="http://www.w3.org/1999/html"> <head> <meta charset="utf-8"> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script> </head> <body> <script type="text/javascript"> var app = angular.module("myApp", []); app.controller("FirstCtrl",function ($scope) { $scope.count = 0; $scope.increment = function (){ $scope.count = $scope.count + 1; } }); </script > <div ng-controller="FirstCtrl"> <button class="btn" ng-model="count" ng-click="increment()"> Click to increment</button> {{ count }} </div> what is wrong with it? When I work without controllers it's works fine but when I use app and app.controller It will not work. why is that? am I doing something wrong?