Below is the error message i get for the code i have written. I have mention the code after the error message. I am new and need help!!
Uncaught SyntaxError: Unexpected token {angular.min.js:6
Uncaught Error: [$injector:modulerr]
http://errors.angularjs.org/1.4.3/$injector/modulerr?p0=mainApp&p1=Error%3A…A%2F%2Flocalhost%3A8084%2FAngularProject%2FLib%2Fangular.min.js%3A19%3A339)(anonymous
function) @ angular.min.js:6(anonymous function) @ angular.min.js:38m
@ angular.min.js:7g @ angular.min.js:37eb @ angular.min.js:40d @
angular.min.js:19Ac @ angular.min.js:20Zd @
angular.min.js:18(anonymous function) @ angular.min.js:289a @
angular.min.js:176c @ angular.min.js:35"
<script src="Lib/angular.min.js" type="text/javascript"></script>
<script src="Lib/angular-route.js" type="text/javascript"></script>
<script>
var demoApp=angular.module('mainApp',[ngRoute]);
demoApp.config(function($routeProvider){
$routeProvider
.when('/',
{
controller:'SimpleController',
templateUrl:'view1.html'
})
.when('/view1',{
controller:'SimpleController',
templateUrl:'/view.html'
})
.otherwise({redirectTo:'/'});
});
demoApp.controller('SimpleController',function($scope){
$scope.customers=[
{name:'Joe',city:'Toronto'},
{name:'Jane',city:'Sydney'},
{name:'Roberto',city:'Vienna'},
{name:'Kumiko',city:'Japan'}
];
$scope.addCustomer=funtion(){
$scope.customers.push({name:$scope.newCustomer.name,city:$scope.newCustomer.city});
};
});/*
function SimpleController($scope){
$scope.customers=[
{name:'Sabin',city:'Bhaktapur'},
{name:'Abhi',city:'Lalitpur'},
{name:'shree',city:'Kathmandu'},
{name:'rameshwor',city:'Bhojpur'}
];
}*/
</script>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…