generator-gulp-angular
generator-gulp-angular copied to clipboard
write all modules together?
I've updated to lastest version, using ES6, and all angular module
are defined in index.module.js
, how to define controller, directive, filter
in each component ?
/* global malarkey:false, moment:false */
import { config } from './index.config';
import { routerConfig } from './index.route';
import { runBlock } from './index.run';
import { MainController } from './main/main.controller';
import { GithubContributorService } from '../app/components/githubContributor/githubContributor.service';
import { WebDevTecService } from '../app/components/webDevTec/webDevTec.service';
import { NavbarDirective } from '../app/components/navbar/navbar.directive';
import { MalarkeyDirective } from '../app/components/malarkey/malarkey.directive';
angular.module('app', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSanitize', 'ngMessages', 'ngAria', 'ngResource', 'ui.router', 'ui.bootstrap', 'toastr'])
.constant('malarkey', malarkey)
.constant('moment', moment)
.config(config)
.config(routerConfig)
.run(runBlock)
.service('githubContributor', GithubContributorService)
.service('webDevTec', WebDevTecService)
.controller('MainController', MainController)
.directive('acmeNavbar', NavbarDirective)
.directive('acmeMalarkey', MalarkeyDirective);
You have to create new angular modules in which you add your controllers and directives. You make the link by adding your new module in this module as a dependency next to the libs.
@Swiip Could you give me some example ? thanks
I dont know if is the better solution, I did this:
// app/components/login/index.module.js import {AuthService} from './authenticate.service'; import {LoginController} from './login.controller';
angular.module('loginModule', []) .service('AuthService', AuthService) .controller('LoginController', LoginController);
// .index.module.js
import { config } from './index.config'; import { routerConfig } from './index.route'; import { runBlock } from './index.run'; import { MainController } from './main/main.controller'; import { GithubContributorService } from '../app/components/githubContributor/githubContributor.service'; import { WebDevTecService } from '../app/components/webDevTec/webDevTec.service'; import { NavbarDirective } from '../app/components/navbar/navbar.directive'; import { MalarkeyDirective } from '../app/components/malarkey/malarkey.directive';
import {LoginModule} from '../app/components/login/index.module'; // load module, I just need gulp compiled...
angular.module('app', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSanitize', 'ngMessages', 'ngAria', 'ngResource', 'ui.router', 'ui.bootstrap', 'toastr', 'loginModule']) // inject login module .constant('malarkey', malarkey) .constant('moment', moment) .config(config) .config(routerConfig) .run(runBlock) .service('githubContributor', GithubContributorService) .service('webDevTec', WebDevTecService) .controller('MainController', MainController) .directive('acmeNavbar', NavbarDirective) .directive('acmeMalarkey', MalarkeyDirective);
@idwd, hi, I think it's a good idea.:)