Powerful, easy-to-use app container for Angular.js with ES Modules. Types included. IE11 supported.
> Powerful, easy-to-use app container for Angular.js with ES Modules. Types included. IE11 supported.
``js
import { app, NgRouter } from '@ledge/ng-app';
import * as components from './components';
import * as routes from './routes';
import 'ng1dependency1';
import 'ng1dependency2';
/**
* Use any Angular.js module
*/
app.addDependencies('ng1dependency1', 'ng1dependency2');
/**
* Submit your component declarations as a simple object
*/
app.addComponents(components);
/**
* Write interceptors with no boilerplate
*/
app.addHttpInterceptor({
request(cfg) {
// ...
return cfg;
},
requestError(err) {
// ...
return err;
},
response(rsp) {
// ...
return rsp;
},
responseError(err) {
// ...
return err;
},
});
/**
* Work with raw Angular.js module APIs
*/
app.module.run(['serviceName', (serviceName) => {
// run block code
}]);
app.module.config(['serviceName', (serviceName) => {
// config block code
}]);
/**
* Use state-based routing with angular-ui-router
* @see https://github.com/angular-ui/ui-router
* @see https://github.com/ui-router/core
*/
class AppRouter extends NgRouter {
constructor() {
this.routes = [/ ... /];
}
getRoutes() {
return this.routes;
}
}
app.setRouter(new AppRouter());
/**
* Initiate the container
*/
app.bootstrap();
`
`js
import { app } from '@ledge/ng-app';
const http = app.http; // using $http service
const log = app.log; // using $log service + custom toast w/ bootstrap classes
const modal = app.modal; // using custom modal w/ bootstrap classes
`
- Compatible with Bootstrap 4
- Supports disabled, required and readonly attributes, as well as their ng-equivalentsangular-messages
- Generates well-formed & accessible HTML structures with labels, ids, names, etc.
- Validation applied via
`html
Label Text
Label Text
Label Text
Other Label Text
Date Label Text
Description for the Model 3 checkbox
IE11 Support
ng-app
.js bundles are compiled to ES5 & are drop-in ready for IE11ng-app
.cjs/.mjs bundles are compiled to ES2015 & are NOT drop-in ready for IE11 (see below)ng-app requires no polyfills to run in IE11
$3
`html
Document
`$3
By default, the
.mjs` bundle will be used. This bundle is compiled to es2015 and does NOT run in IE11 out-of-the-box. You can either alias to the es5 bundles or transform the bundle using a plugin. For an example of the latter, see the webpack configuration in the project repository.