1
私はこのように私の角度のコードを整理したい:モジュール式に経路の後ろに角度コードをロードするにはどうすればよいですか?
project/
thing/
thing.js
view.html
other_thing/
other_thing.js
view.html
それから私は、URLのparamsに基づいたものを選ぶのルーティングを含める:
$routeProvider
.when('/thing', {
templateUrl: 'thing/thing.html',
controller: 'thingController'
})
.when('/other_thing', {
templateUrl: 'other_thing/other_thing.html',
controller: 'otherThingController'
});
$locationProvider.html5Mode(true);
私が欠けている何をロードする方法でありますthingController
およびotherThingController
が必要です。私が50種類のコントローラーを持っていて、すべてをロードしたくない場合、クライアントが実際にjsをロードするルートを訪れるまで待ちます。ユーザーがナビゲートするまでにtemplateUrlがロードされないのと同様ですそこ。
するのに役立ちますように。 – Claies
@Claries ocLaxyLoadとangularAMDは遅延読み込みに使用されますが、彼はURL上でこのことが必要です。 –