私はjohn papas styleguideに近いいくつかのモジュールを持つ角型のアプリケーションを構築しています。それに続いて、独自のルート定義とインターセプタを持つ独立したモジュールがいくつかあります。私の問題は、Cordova/Android上で実行すると、状態定義はメインモジュールに入れても機能するように見えます。私のブラウザでは仕事。誰もこの問題をまだ巡っていませんか?コルドーバで角運動が異なる
など。
//main.js
'use strict';
angular.module('main', [
'app.core',
'auth'
])
.config(function ($stateProvider, $urlRouterProvider) {
// ROUTING with ui.router
$urlRouterProvider.otherwise('/main/list');
$stateProvider
// this state is placed in the <ion-nav-view> in the index.html
.state('main', {
url: '/main',
abstract: true,
templateUrl: 'main/templates/menu.html',
controller: 'MenuCtrl as menu'
})
.state('main.login', {
url: '/login',
views: {
'pageContent': {
templateUrl: 'auth/templates/auth.login.html',
controller: 'LoginCtrl'
}
}
})
/* more states here */
ローカルブラウザでのみ有効です(上記のようにメインモジュールと同じ)::
//auth.routes.js
'use strict';
angular
.module('auth.routes')
.config(config);
function config ($stateProvider) {
$stateProvider
.state('main.login', {
url: '/login',
views: {
'pageContent': {
templateUrl: 'auth/templates/auth.login.html',
controller: 'LoginCtrl'
}
}
})
}
//auth.module.js
'use strict';
angular.module('auth', [
'app.core',
'auth.constants',
'auth.routes',
'auth.controllers',
'auth.services',
'auth.interceptors',
'auth.config'
]);
angular.module('auth.constants', []);
angular.module('auth.routes', []);
angular.module('auth.controllers', []);
angular.module('auth.services', []);
angular.module('auth.interceptors', []);
angular.module('auth.config', []);
エラー状態は、ナビゲーション上で見つからなかったことを言って、これはコルドバで両方のローカルブラウザ上およびデバイス上で動作します。
これは例のためだと思いますが、2番目のコード部分では "main"状態を定義しておらず、その子 "main.login"だけを定義しています。それが問題だろうか? – Cyberdelphos
このコードでは、前に定義したauth.routesモジュールをこの行angular.module( 'auth.routes'、[]);で上書きしています。それも問題かもしれません。 –
私はそれを上書きしないように定義しています – niklas