0
尋找您的幫助 我的應用程序路由不工作(其負載的主頁),但當我試圖路由登錄它沒有做任何事情(就像它無法找到它,甚至是我註冊了它) 暫時無法解決這個問題。 Thx的幫助!webpack angularjs路由不工作
這裏是文件代碼:
Login.index.js:
import './login.css'
import angular from 'angular';
import uirouter from '@uirouter/angularjs';
import routing from './login.routes';
import LoginController from './login.controller';
export default angular.module('arrowfind.login', [uirouter])
.config(routing)
.controller('LoginController', LoginController)
.name;
Login.routes.js:
routes.$inject = ['$stateProvider'];
export default function routes($stateProvider) {
$stateProvider
.state('login', {
url: '/login',
template: require('./login.html'),
controller: 'LoginController',
controllerAs: 'login'
});
}
主應用程序設置(index.config.js) :
routing.$inject = ['$urlRouterProvider', '$locationProvider'];
export default function routing($urlRouterProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$urlRouterProvider.otherwise('/');
}
App Js(index.js):
import './index.css';
import angular from 'angular';
import uirouter from '@uirouter/angularjs';
import routing from './index.config';
import navbar from './components/navbar';
import landing from './components/landing';
import login from './components/login';
angular.module('arrowfind', [uirouter, navbar, landing, login])
.config(routing);
的HTML:
<li class="nav-item">
<a class="nav-link" href="#/Login" id="loginlink">Login</a>
</li>