diff --git a/Gruntfile.js b/Gruntfile.js index 25569ecb..9e00deae 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -183,7 +183,7 @@ module.exports = function (grunt) { }, javascripts: { files: ['src/javascripts/ng-admin.js', 'src/javascripts/ng-admin/**/**/*.js', 'src/javascripts/ng-admin/**/**/*.html'], - tasks: ['ngconfig', 'requirejs:dev', 'copy:js_dev', 'copy:es6_dev', 'copy:es6_devmap'], + tasks: ['ngconfig', 'requirejs:dev', 'ngAnnotate', 'copy:js_dev', 'copy:es6_dev', 'copy:es6_devmap'], options: { atBegin: true, livereload: true @@ -250,7 +250,7 @@ module.exports = function (grunt) { grunt.registerTask('test:local', ['mochaTest', 'karma', 'build:dev', 'copy_build:dev', 'test:local:e2e']); grunt.registerTask('test:local:e2e', ['json_server', 'connect', 'protractor']); - grunt.registerTask('build:dev', ['ngconfig', 'requirejs:dev', 'compass:dev', 'concat:css']); + grunt.registerTask('build:dev', ['ngconfig', 'requirejs:dev', 'ngAnnotate', 'compass:dev', 'concat:css']); grunt.registerTask('copy_build:dev', ['copy:es6_dev', 'copy:es6_devmap', 'copy:js_dev', 'copy:angular', 'copy:css_dev', 'copy:fonts_dev', 'clean']); // register default task diff --git a/README.md b/README.md index 1e2ffc26..691f272e 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ Check out the [online demo](http://ng-admin.marmelab.com/) ([source](https://git * [Installation](#installation) * [Example Configuration](#example-configuration) +* [Application Configuration](#application-configuration) * [Entity Configuration](#entity-configuration) * [View Configuration](#view-configuration) * [Menu Configuration](#menu-configuration) @@ -71,6 +72,17 @@ Your application should use a `ui-view`:
``` +### Production ready + +You can enable `ng-strict-di` angular mode to boost your application performance: +```html + +``` + +Ng-admin library is already compatible, but you have to explicitly declare dependencies on your custom application code. + +See [Angular documentation](https://docs.angularjs.org/guide/production) for more details about this tweak. + ## Example Configuration We chose to define the entities & views directly in JavaScript to allow greater freedom in the configuration. @@ -83,7 +95,7 @@ var app = angular.module('myApp', ['ng-admin']); app.config(function (NgAdminConfigurationProvider) { var nga = NgAdminConfigurationProvider; - var app = nga.application('ng-admin backend demo') // application main title + var app = nga.application('ng-admin backend demo', false) // application main title and debug disabled .baseApiUrl('http://localhost:3000/'); // main API endpoint // define all entities at the top to allow references between them @@ -160,6 +172,32 @@ app.config(function (NgAdminConfigurationProvider) { You can find a more detailed configuration in the [blog demo configuration](examples/blog/config.js). +## Application Configuration + +Application is the base of your admin. + +Create a new application: + +```js +// set the title and disable debug for this admin +var app = nga.application('My backend', false); +``` + +* `title()` +Defines the title + + var app = nga.application().title('My backend') + +* `baseApiUrl()` +Defines the main API endpoint + + var app = nga.application().baseApiUrl('http://localhost:3000/') + +* `debug()` +Enable or disable debug (enabled by default) + + var app = nga.application().debug(false) + ## Entity Configuration Each entity maps to a different API endpoint. The name of the entity, defines the endpoint: diff --git a/examples/blog/config.js b/examples/blog/config.js index 554a7030..b72528cd 100644 --- a/examples/blog/config.js +++ b/examples/blog/config.js @@ -4,7 +4,7 @@ var app = angular.module('myApp', ['ng-admin']); - app.config(function (NgAdminConfigurationProvider, RestangularProvider) { + app.config(['NgAdminConfigurationProvider', 'RestangularProvider', function (NgAdminConfigurationProvider, RestangularProvider) { var nga = NgAdminConfigurationProvider; function truncate(value) { @@ -42,6 +42,7 @@ }); var admin = nga.application('ng-admin backend demo') // application main title + .debug(false) // debug disabled .baseApiUrl('http://localhost:3000/'); // main API endpoint // define all entities at the top to allow references between them @@ -276,7 +277,7 @@ ); nga.configure(admin); - }); + }]); app.directive('postLink', ['$location', function ($location) { return { @@ -333,7 +334,7 @@ '' + ''; - app.config(function ($stateProvider) { + app.config(['$stateProvider', function ($stateProvider) { $stateProvider.state('send-post', { parent: 'main', url: '/sendPost/:id', @@ -342,7 +343,7 @@ controllerAs: 'controller', template: sendPostControllerTemplate }); - }); + }]); // custom page with menu item var customPageTemplate = 'You can add custom pages, too
' + '