0
var app = angular.module("myApp", ['ui.router']).
config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('login', {
url: '/login',
templateUrl: '/templates/LoginPage.html',
controller: 'loginController'
});
}]);
app.controller("homePageController", function ($scope, $state) {
var self = this;
$scope.isLoginError = false;
$scope.loginSuccess = false;
$scope.validateCredentials = function() {
if ($scope.userName != '' && $scope.passWord != '') {
$scope.loginSuccess = true;
$scope.isLoginError = false;
// $location.url('/login');
$state.go('login');
}
else {
$scope.isLoginError = true;
}
}
});
//これは私のangularJSコードであり、状態が変更されたときですhttp://localhost:44212/templates/homePage.html#!/login私は取得しています!他のビューには移動しません。AngularJS州のプロバイダが動作していません
Can anyone please help me out to solve this problem.
Thanks in advance.
(HTTPS [angularjsアプリでハッシュ後の感嘆符(#!)]の可能性の重複: //stackoverflow.com/questions/41214312/exclamation-mark-after-hash-in-angularjs-app)と[URLハッシュバング(#!/)接頭辞](https://stackoverflow.com/questions/41226122/ url-hash-bang-prefix-of-simple-hash-in-角度1-6) –
今私は取得していない! $ locationProvider.hashPrefixを追加した後( '');これを追加する。今、このURLはhttp:// localhost:44212/templates/homePage.html#/ loginのようなものです。それでも、指定されたビューにナビゲートしていません。 – Nandha
これを試してください$ locationProvider.hashPrefix( '!'); –