我一直在努力尝试将此依赖关系(http://flowjs.github.io/ng-flow/)与我的mean.js应用程序挂钩。我认为这只是一个命名问题。
我得到的错误是:错误:[$ injector:unpr]未知提供商:flowProvider< - flow
我已尝试过'流动'流动' ngFlow'等等。非常感谢任何帮助。
模块/核心/客户端/应用程序/ config.js
'use strict';
// Init the application configuration module for AngularJS application
var ApplicationConfiguration = (function() {
// Init module configuration options
var applicationModuleName = 'mean';
var applicationModuleVendorDependencies = ['ngResource', 'ngAnimate', 'ui.router', 'ui.bootstrap', 'ui.utils', 'angularFileUpload', 'flow'];
// 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
};
})();
modules/properties/client/properties.client.controller.js:
'use strict';
var $ = $ || {};
// Properties controller
angular.module('properties').controller('PropertiesController', [
'$scope',
'$stateParams',
'$location',
'Authentication',
'Brands',
'Applications',
'Properties',
'flow',
function($scope, $stateParams, $location, Authentication, Brands, Applications, Properties, flow) {
.......
模块/属性/客户端/ properties.client.module.js:
'use strict';
// Use applicaion configuration module to register a new module
//ApplicationConfiguration.registerModule('properties');
ApplicationConfiguration.registerModule('properties',['flow']);
配置/资产/ default.js:
'使用严格的';
module.exports = {
client: {
lib: {
css: [
'public/lib/bootstrap/dist/css/bootstrap.css',
'public/lib/bootstrap/dist/css/bootstrap-theme.css'
],
js: [
'public/lib/angular/angular.js',
'public/lib/angular-resource/angular-resource.js',
'public/lib/angular-animate/angular-animate.js',
'public/lib/angular-ui-router/release/angular-ui-router.js',
'public/lib/angular-ui-utils/ui-utils.js',
'public/lib/angular-bootstrap/ui-bootstrap-tpls.js',
'public/lib/angular-file-upload/angular-file-upload.js',
'public/lib/jquery/dist/jquery.js',
'public/lib/ng-flow/dist/ng-flow-standalone.js'
],
tests: ['public/lib/angular-mocks/angular-mocks.js']
},
css: [
'modules/*/client/css/*.css'
],
less: [
'modules/*/client/less/*.less'
],
sass: [
'modules/*/client/scss/*.scss'
],
js: [
'modules/core/client/app/config.js',
'modules/core/client/app/init.js',
'modules/*/client/*.js',
'modules/*/client/**/*.js'
],
views: ['modules/*/client/views/**/*.html']
},
server: {
allJS: ['gruntfile.js', 'server.js', 'config/**/*.js', 'modules/*/server/**/*.js'],
models: 'modules/*/server/models/**/*.js',
routes: ['modules/*[!core]/server/routes/**/*.js', 'modules/core/server/routes/**/*.js'],
sockets: 'modules/*/server/sockets/**/*.js',
config: 'modules/*/server/config/*.js',
policies: 'modules/*/server/policies/*.js',
views: 'modules/*/server/views/*.html'
}
};
答案 0 :(得分:1)
只要正确加载js文件,就可以使用flowFactory
创建流实例。然后创建一个流对象并使用它来引用流。
angular.module('properties').controller('PropertiesController', [
'$scope',
'$stateParams',
'$location',
'Authentication',
'Brands',
'Applications',
'Properties',
'flowFactory',
function($scope, $stateParams, $location, Authentication, Brands, Applications, Properties, flowFactory) {
$scope.existingFlowObject = flowFactory.create({
target: 'http://example.com/upload'
});
................................................................
因此,请尝试将flow
更改为flowFactory
,看看是否会导致任何提供程序依赖性问题。
答案 1 :(得分:0)
我没有看到答案。更改registerModule部分。
ApplicationConfiguration.registerModule('流速&#39);
到.client.module.js
这是mean.js版本0.4.0
答案 2 :(得分:0)
您不必将其包含在项目依赖项中 我用这种方式修改了它:
var applicationModuleVendorDependencies = ['ngResource', 'ngAnimate', 'ui.router', 'ui.bootstrap', 'ui.utils', 'angularFileUpload'];