All Projects → subchen → Angular Async Loader

subchen / Angular Async Loader

Licence: apache-2.0
Load modules and components asynchronously for angular 1.x application.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Angular Async Loader

Require Vuejs
RequireJS plugin to async and dynamic load and parse .vue components
Stars: ✭ 143 (+4.38%)
Mutual labels:  requirejs, amd, async
Play Angular Require Seed
Seed Application for Playframework 2, RequireJS, WebJars, and AngularJS 1.x
Stars: ✭ 170 (+24.09%)
Mutual labels:  requirejs, angularjs
Requirejs Demo
《RequreJS学习笔记》
Stars: ✭ 164 (+19.71%)
Mutual labels:  requirejs, amd
amd-cmd-hot-update-hmr
esl-hot-update: Hot update esl modules(AMD、CMD) when modifed. JS, LESS, tpl, component is all supported!
Stars: ✭ 25 (-81.75%)
Mutual labels:  amd, cmd
Hitchcock
The Master of Suspense 🍿
Stars: ✭ 167 (+21.9%)
Mutual labels:  async, loader
Include.js
A tiny but heavy on-demand async javascript/css loader
Stars: ✭ 146 (+6.57%)
Mutual labels:  requirejs, loader
array-sort-by
Powerful mechanism to sort arrays or array of objects by one or more properties. You can also specify a custom comparer function.
Stars: ✭ 37 (-72.99%)
Mutual labels:  amd, requirejs
Ocl
OpenCL for Rust
Stars: ✭ 453 (+230.66%)
Mutual labels:  amd, async
Lodjs
JavaScript模块加载器,基于AMD。迄今为止,对AMD理解最好的实现。
Stars: ✭ 296 (+116.06%)
Mutual labels:  amd, loader
vscode-requirejs
Provides goto definition functionality for require js modules.
Stars: ✭ 20 (-85.4%)
Mutual labels:  amd, requirejs
TypeScript-AMD-Boilerplate
A TypeScript AMD Grunt Boilerplate with RequireJS
Stars: ✭ 46 (-66.42%)
Mutual labels:  amd, requirejs
React Shimmer
🌠 Async loading, performant Image component for React.js
Stars: ✭ 990 (+622.63%)
Mutual labels:  async, loader
ng-loader
Webpack loader for AngularJs components
Stars: ✭ 28 (-79.56%)
Mutual labels:  angularjs, loader
Esl
enterprise standard loader
Stars: ✭ 821 (+499.27%)
Mutual labels:  amd, loader
Conditioner
💆🏻 Frizz free, context-aware, JavaScript modules
Stars: ✭ 1,053 (+668.61%)
Mutual labels:  requirejs, amd
Pyrogram
Telegram MTProto API Client Library and Framework in Pure Python for Users and Bots
Stars: ✭ 2,252 (+1543.8%)
Mutual labels:  async
Ng Block Ui
Block UI Loader/Spinner for Angular
Stars: ✭ 135 (-1.46%)
Mutual labels:  loader
Angular Interview Questions
List of 300 Angular Interview Questions and answers
Stars: ✭ 2,264 (+1552.55%)
Mutual labels:  angularjs
Sieppari
Small, fast, and complete interceptor library for Clojure/Script
Stars: ✭ 133 (-2.92%)
Mutual labels:  async
Cppcoro
A library of C++ coroutine abstractions for the coroutines TS
Stars: ✭ 2,118 (+1445.99%)
Mutual labels:  async

NPM Repo License

angular-async-loader

Load modules and components asynchronously for angular 1.x application.

Support load angular modules:

  • app.useModule(name)

Support load angular components:

  • app.controller
  • app.services
  • app.filter
  • app.directive
  • app.value
  • app.constant
  • app.provider
  • app.decorator

Support following amd/cmd loaders:

  • Require.js
  • Sea.js
  • System.js

Support controllerUrl/denpendencies config in angular-ui-router and angular-route:

  • $stateProvider.state
  • $routeProvider.when

Demo

http://subchen.github.io/angular-async-loader/demo/

Installation

npm

npm install angular-async-loader

bower

bower install https://github.com/subchen/angular-async-loader.git

Usage

index.html

<script src="assets/requirejs/require.js"></script>
<script src="bootstrap.js"></script>

bootstrap.js

require.config({
    baseUrl: '/',
    paths: {
        'angular': 'assets/angular/angular.min',
        'angular-ui-router': 'assets/angular-ui-router/release/angular-ui-router.min',
        'angular-async-loader': 'assets/angular-async-loader/angular-async-loader.min',
        'angular-ui-mask': 'assets/angular-ui-mask/dist/mask.min',
        'ng-tags-input': 'assets/ng-tags-input/build/ng-tags-input.min'
    },
    shim: {
        'angular': {exports: 'angular'},
        'angular-ui-router': {deps: ['angular']}
    }
});

require(['angular', './app-routes'], function (angular) {
    angular.element(document).ready(function () {
        angular.bootstrap(document, ['app']);
        angular.element(document).find('html').addClass('ng-app');
    });
});

app.js

define(function (require, exports, module) {
    var angular = require('angular');
    var asyncLoader = require('angular-async-loader');

    require('angular-ui-router');

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

    // initialze app module for angular-async-loader
    asyncLoader.configure(app);

    module.exports = app;
});

app-routes.js

define(function (require) {
    var app = require('./app');

    app.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
        $urlRouterProvider.otherwise('/home');

        $stateProvider
            .state('home', {
                url: '/home',
                templateUrl: 'home/home.html',
                // new attribute for ajax load controller
                controllerUrl: 'home/homeCtrl',
                controller: 'homeCtrl'
            })
            .state('users', {
                url: '/users',
                templateUrl: 'users/users.html',
                // new attribute for ajax load controller
                controllerUrl: 'users/usersCtrl',
                controller: 'usersCtrl',
                // support to load more controllers, services, filters, ...
                dependencies: ['services/usersService']
            })
            .state('components', {
                url: '/components',
                templateUrl: 'components/components.html',
                // new attribute for ajax load controller
                controllerUrl: 'components/componentsCtrl',
                controller: 'componentsCtrl'
            });
    }]);
});

users/usersCtrl.js

define(function (require) {
    var app = require('../app');

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

    app.controller('usersCtrl', ['$scope', function ($scope) {
        // shortcut to get angular injected service.
        var userServices = app.get('usersService');
        $scope.userList = usersService.list();
    }]);

});

components/componentsCtrl.js

define(function (require) {
    var app = require('../app');

    // dynamic load angular-ui-mask plugins for UI
    require('angular-ui-mask');
    app.useModule('ui.mask');

    // dynamic load ng-tags-input plugins for UI
    require('ng-tags-input');
    app.useModule('ngTagsInput');

    app.controller('componentsCtrl', ['$scope', function ($scope) {
        ......
    }]);

});

Build from Source

git clone https://github.com/subchen/angular-async-loader.git

cd angular-async-loader

./make.sh install
./make.sh test

open browser http://localhost:3000/

License

Released under the Apache 2 License.

Copyright 2015-2016 Guoqiang Chen

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].