I get an AngularJS error with an error when starting the following example, please let me know where I am doing wrong? Actually the following code works fine if I run outside / fine, but when I copy / paste this code into my application, it gives the following error. (this page / tab is displayed from my application controller, for example: TestController, which is available in coffeescript, but I donβt need any coffeescript for this requirement, I need it in AngularJs. So, on this tab I need to display below the code / button .
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script> var myApp = angular.module('myApplication', []); myApp.controller('TestController', ['$scope', function($scope){ $scope.test = function(){ alert("Success"); } }]); </script> </head> <body> <div ng-app="myApplication"> <div ng-controller="TestController"> <div class="tab-pane" id="wizards"> <button type="button" ng-click="test();">Test</button> </div></div></div> </body> </html>
Error: Error: [ng:areq] http://errors.angularjs.org/1.4.8/ng/areq?p0=TestController&p1=not%20a%20function%2C%20got%20undefined
source share