angularjs - Run controller in angular js -
i new angularjs made 1 example call controller not able call controller ...
this sample code
<head> <meta charset="utf-8"> <title>insert title here</title> <script type="text/javascript" src="js/jquery-1.9.0.js"></script> <script type="text/javascript" src="angularjs/angular.min.js"></script> </head> <body ng-app=""> <div data-ng-controller="mycontroller"> </div> <script> function mycontroller($scope, $http) { alert("alert"); } </script> </body>
try this
<body ng-app="learning"> <div data-ng-controller="mycontroller"> </div> <script> angular.module("learning", []) .controller("mycontroller", function($scope, $http) { alert("alert"); }); </script> </body>
Comments
Post a Comment