javascript - Angular could not find my controller -
in app i'm trying pass id
value controller this:
http://localhost:29045/visitormain/?id=afef8e80-0864-e411-8865-000c295e296b
but getting "the resource cannot found" error.
here code below: app.js
'use strict'; var app = angular.module('loginapp', ['ngroute']); app.config(['$routeprovider', function($routeprovider) { $routeprovider.when('/login', { templateurl: 'partials/login.html', controller: 'logincontroller' }); $routeprovider.when('/visitormain/:id', { templateurl: 'partials/visitormain.html', controller: 'visitorcontroller' }); $routeprovider.otherwise({ redirectto: '/login' }); } ]);
visitorcontroller.js
'use strict'; app.controller('visitorcontroller', function($scope, $routeparams) { //console.log(id); //console.log(username); // $scope.login = function (user) { // loginservice.login(user); // } });
calling visitorcontroller
$http.get('/visitormain/', { params: { id: "someid" } });
result:
any suggestions?
you forgetting hashtag. try
$http.get('/#/visitormain/', { params: { id: "someid" } });
Comments
Post a Comment