Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit eac61a1

Browse files
committed
Update README.md
1 parent 9788548 commit eac61a1

File tree

1 file changed

+66
-20
lines changed

1 file changed

+66
-20
lines changed

‎README.md

Lines changed: 66 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@
55

66
An async loader for angular 1.x application.
77

8-
Support following components to dynamic register:
8+
Support use dynamic angular module:
9+
* `app.useModule(name)`
910

10-
* `.controller`
11-
* `.services`
12-
* `.filter`
13-
* `.directive`
14-
* `.value`
15-
* `.constant`
16-
* `.provider`
17-
* `.decorator`
11+
Support use origin methods to dynamic register angular components:
12+
13+
* `app.controller`
14+
* `app.services`
15+
* `app.filter`
16+
* `app.directive`
17+
* `app.value`
18+
* `app.constant`
19+
* `app.provider`
20+
* `app.decorator`
1821

1922
Support following amd/cmd loaders:
2023

@@ -27,25 +30,26 @@ Support `controllerUrl/denpendencies` config in `angular-ui-router` and `angular
2730
* `$stateProvider.state`
2831
* `$routeProvider.when`
2932

33+
# Demo
34+
35+
http://subchen.github.io/angular-async-loader/
3036

3137
# Installation
3238

33-
NPM
39+
npm
3440

3541
```shell
3642
npm install angular-async-loader
3743
```
3844

39-
BOWER
45+
bower
4046

4147
```shell
4248
bower install https://github.com/subchen/angular-async-loader.git
4349
```
4450

4551
# Usage
4652

47-
See Sample: https://github.com/subchen/angular-async-loader/blob/master/sample/
48-
4953
**index.html**
5054

5155
```html
@@ -61,6 +65,7 @@ require.config({
6165
paths: {
6266
'angular': 'assets/angular/angular.min',
6367
'angular-ui-router': 'assets/angular-ui-router/release/angular-ui-router.min',
68+
'angular-ui-mask': 'assets/angular-ui-mask/dist/mask',
6469
'angular-async-loader': 'assets/angular-async-loader/dist/angular-async-loader.min'
6570
},
6671
shim: {
@@ -88,7 +93,7 @@ define(function (require, exports, module) {
8893

8994
var app = angular.module('app', ['ui.router']);
9095

91-
// initialze app module for asyncloader
96+
// initialze app module for angular-async-loader
9297
asyncLoader.configure(app);
9398

9499
module.exports = app;
@@ -112,15 +117,22 @@ define(function (require) {
112117
controllerUrl: 'home/homeCtrl',
113118
controller: 'homeCtrl'
114119
})
115-
.state('users', app.route({
120+
.state('users', {
116121
url: '/users',
117122
templateUrl: 'users/users.html',
118123
// new attribute for ajax load controller
119124
controllerUrl: 'users/usersCtrl',
120125
controller: 'usersCtrl',
121-
// load more controllers, services, filters, ...
126+
// support to load more controllers, services, filters, ...
122127
dependencies: ['services/usersService']
123-
}));
128+
})
129+
.state('components', {
130+
url: '/components',
131+
templateUrl: 'components/components.html',
132+
// new attribute for ajax load controller
133+
controllerUrl: 'components/componentsCtrl',
134+
controller: 'componentsCtrl'
135+
});
124136
}]);
125137
});
126138
```
@@ -131,25 +143,59 @@ define(function (require) {
131143
define(function (require) {
132144
var app = require('../app');
133145

134-
// dynamic load services here or add into dependencies of state config
146+
// dynamic load services here or add into dependencies of ui-router state config
135147
// require('../services/usersService');
136148

137149
app.controller('usersCtrl', ['$scope', function ($scope) {
138150
// shortcut to get angular injected service.
139151
var userServices = app.get('usersService');
140-
141152
$scope.userList = usersService.list();
142153
}]);
143154

144155
});
145156
```
146157

158+
**components/componentsCtrl.js**
159+
160+
```js
161+
define(function (require) {
162+
var app = require('../app');
163+
164+
// dynamic load angular-ui-mask plugins for UI
165+
require('angular-ui-mask');
166+
app.useModule('ui.mask');
167+
168+
// dynamic load ng-tags-input plugins for UI
169+
require('ng-tags-input');
170+
app.useModule('ngTagsInput');
171+
172+
app.controller('componentsCtrl', ['$scope', function ($scope) {
173+
......
174+
}]);
175+
176+
});
177+
```
178+
179+
180+
# Build from Source
181+
182+
```
183+
git clone https://github.com/subchen/angular-async-loader.git
184+
185+
cd angular-async-loader
186+
187+
npm run build
188+
npm start
189+
190+
open browser http://localhost:3000/
191+
```
192+
147193
# License
148194

149195
Released under the [Apache 2 License](http://www.apache.org/licenses/LICENSE-2.0).
150196

151197
```
152-
Copyright 2015 Guoqiang Chen
198+
Copyright 2015-2016 Guoqiang Chen
153199
154200
Licensed under the Apache License, Version 2.0 (the "License");
155201
you may not use this file except in compliance with the License.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /