使用yeoman安装和注入ng-flow [英] Installing and injecting ng-flow using yeoman

查看:109
本文介绍了使用yeoman安装和注入ng-flow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从这里使用yo meanjs样板: yo meanjs .

I am working with the yo meanjs boilerplate from here :yo meanjs.

我知道我可以使用$ yo meanjs:angular-module <module-name>创建自己的模块.

I know I can create my own module using $ yo meanjs:angular-module <module-name> .

是否可以使用命令yo将控制器 ng-flow 安装并注入到我的控制器中线?

Is it possible to install and inject into my controller ng-flow using yo from the command line?

类似的东西:$ yo meanjs:ng-flow <module-name>

它在文档中指出可以在这里找到 meanjs模块:因此,除非有更好的方法建议我可以尝试此路线.

In the documentation it states found here meanjs modules: So unless there are any better suggestions I might try this route.

要添加第三方模块,请使用public/config.js文件,在该文件中添加了一个名为applicationModuleVendorDependencies的数组属性.当您添加新的第三方模块时,应将其添加到此数组中,以便主模块可以将其作为依赖对象加载.

'use strict';

// Init the application configuration module for AngularJS application

var ApplicationConfiguration = (function() {
    // Init module configuration options
    var applicationModuleName = 'theconnect';
    var applicationModuleVendorDependencies = ['ngResource', 'ngCookies',  'ngAnimate',  'ngTouch',  'ngSanitize',  'ui.router', 'ui.bootstrap', 'ui.utils'];

        // Add a new vertical module
        var registerModule = function(moduleName, dependencies) {
            // Create angular module
            angular.module(moduleName, dependencies || []);

            // Add the module to the AngularJS configuration file
            angular.module(applicationModuleName).requires.push(moduleName);
        };

        return {
            applicationModuleName: applicationModuleName,
            applicationModuleVendorDependencies: applicationModuleVendorDependencies,
            registerModule: registerModule
        };
    })();

推荐答案

使用以下命令通过cmd行添加模块后:

After adding module via cmd line using :

bower install "ng-flow#~2" --save
 grunt bower-install

我将其添加为对public/config.js的依赖:

I added it as as dependency to public/config.js :

var applicationModuleVendorDependencies = ['ngResource', 'ngCookies',  'ngAnimate',  'ngTouch',  'ngSanitize',  'ui.router', 'ui.bootstrap', 'ui.utils','flow'];

然后将模块路径添加到/config/env目录下的所有JS文件中.

then added the module path to the all the JS files under the /config/env directory.

module.exports = {
    db: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/theconnect',
    assets: {
        lib: {
            css: [
                'public/lib/bootstrap/dist/css/bootstrap.min.css',
                'public/lib/bootstrap/dist/css/bootstrap-theme.min.css',
            ],
            js: [
                'public/lib/angular/angular.min.js',
                'public/lib/angular-resource/angular-resource.js', 
                'public/lib/angular-cookies/angular-cookies.js', 
                'public/lib/angular-animate/angular-animate.js', 
                'public/lib/angular-touch/angular-touch.js', 
                'public/lib/angular-sanitize/angular-sanitize.js', 
                'public/lib/angular-ui-router/release/angular-ui-router.min.js',
                'public/lib/angular-ui-utils/ui-utils.min.js',
                'public/lib/angular-bootstrap/ui-bootstrap-tpls.min.js',
                'public/lib/ng-flow/dist/ng-flow.js'
            ]
        },
        css: 'public/dist/application.min.css',
        js: 'public/dist/application.min.js'
    },
......
...
}

这篇关于使用yeoman安装和注入ng-flow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆