I am using ui.router for my routes in angular. Here is what I am trying to do:
I have my router file where I have defined states like this:
state('login',{
url:'/login',
views:{
'slot1':{
templateUrl:'app/modules/authentication/authentication.html',
controller:'AuthenticationController',
controllerAs:'authCntrl'
}}})
What I want to do is to log the user in is they come with a URL in this format
http://someapp.io/login?user=name&pass=423%%$dsad32
Now how do I define the route URL and how to access the user and pass in my controller. Don't need full code, just the concepts or link to documentation would do.
This is how my controller looks like:
(function(){
angular.module("app.auth",[]).
controller("AuthenticationController", function( $state, $stateParams, AuthenticationService, LoadingService){
var self = this;
console.log($stateParams);
}
And this logs the following to console:
Object {}
EDIT:
Strangely, if I change url in my router to this:
url:'/instore_login?user=&pass='
I am able to get these values. Is this even right?