Below is my app.js
file
angular
.module('repoApp', [
'ngAnimate',
'ngAria',
'ngCookies',
'ngMessages',
'ngResource',
'ngRoute',
'ngSanitize',
'ngTouch',
'ui.bootstrap',
'ui.router'
])
.config(function
($routeProvider) {
$routeProvider
.when('/',
{
templateUrl: 'views/main.html',
controller:
'MainCtrl'
})
.when('/about', {
templateUrl:
'views/about.html',
controller: 'AboutCtrl'
})
.when('/login', {
templateUrl: 'views/loginPage.html',
controller: 'loginCtrl'
})
.otherwise({
redirectTo:
'/'
});
});
angular
.module('loginState',['ui.router']);
Below
is my states
file
angular
.module('repoApp')
.config(function ($stateProvider) {
$stateProvider.state('home1', {
url:'/home1',
templateUrl:
'views/modals/test.html'
})
.state('secondState',{
url:'/secondState',
templateUrl:
'views/modals/secondStateTest.html'
});
});
The problem is,
using my html i navigate to login
page.
but I am
trying to hit the state as soon my flow hit the
controller
angular.module('repoApp')
.controller('loginCtrl', function ($scope,$modal,$state) {
$scope.awesomeThings = [
'HTML5 Boilerplate',
'AngularJS',
'Karma'
];
$state.go('home1');
$scope.openDialog = function () {
$modal.open({
keyboard: 'static',
templateUrl: 'views/login/loginCred.html',
});
};
});
but I am not able
to hit the home state.
If I change my states file i.e
$stateProvider.state('home1',
{
url:'/login',
templateUrl: 'views/modals/test.html'
})
here I changed URL.
It works fine now.
I have a template from where
I want to navigate to a next
state
but
as soon I click this anchor tag it navigates me back to home page. ie not to the state I
intend to go.
The main issue is URL(i guess) any help will be
appreciated.
No comments:
Post a Comment