I am new to angular js..I am getting follwing error please help me out
[ng:areq] Argument 'fn' is not a function, got string
var app = angular.module('demo',[]); app.config('$routeProvider',function($routeProvider){ $routeProvider.when('/add',{ templateUrl:'demo/add.html', controller:'addcontroller' }). when('/order',{ templateUrl:'demo/order.html', controller:'ordercontroller' }); }); app.controller('addcontroller',function($scope){ $scope.message="order"; }); app.controller('ordercontroller',function($scope){ $scope.message="order"; });
I think the error is in the config block, it should either be:
app.config(function($routeProvider){ // routeProvider config });
or better:
app.config(['$routeProvider', function($routeProvider){ // routeProvider config, allows minification }]);
the annotations are there for minification to work correctly. You can read more about it on AngularJS docs https://docs.angularjs.org/tutorial/step_05 Please note that this practice needs to be done throughout the app to work correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With