mean.js 应用程序中的 ngDialog [英] ngDialog in mean.js application

查看:21
本文介绍了mean.js 应用程序中的 ngDialog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 MeanJS 创建了一个 web 应用程序.我想在应用程序中使用 ngDialog,但不确定如何以及在应用程序中添加 ngDialog.js 的位置.我试图在控制器中注入 ngDialog,如下所示,但每次都作为未知提供者错误

I have created a webapp with MeanJS. I want to use ngDialog in the application, but not sure how and where to add the ngDialog.js in the application. Im trying to inject the ngDialog in the controller as shown below, but everytime error as unknown provider

angular.module('myModule').controller('MyController', ['$scope', '$http', 'ngDialog',函数 ($scope, $http, ngDialog) {

angular.module('myModule').controller('MyController', ['$scope', '$http', 'ngDialog', function ($scope, $http, ngDialog) {

错误:错误:[$injector:unpr] 未知提供者:ngDialogProvider <- ngDialog

error : Error: [$injector:unpr] Unknown provider: ngDialogProvider <- ngDialog

谁能告诉我如何在meanjs应用程序中包含ngDialog.

Can anyone please let me know how to include the ngDialog in the meanjs application.

提前致谢

推荐答案

你应该先用 bower 安装 ngDialog.在您的应用程序根目录(bower.json 所在的位置)中,发出以下命令,

You should use bower to install ngDialog first. In your application root (where bower.json is located), issue the following command,

bower install --save ngDialog

然后,确保在应用级别添加 ngDialog 模块.以下答案特定于 MEAN.JS.

Then, make sure you add ngDialog module in the app level. The following answer is specific to MEAN.JS.

在文件public/config.js中,找到一行

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

在列表末尾添加'ngDialog'

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

然后,将 ngDialog 的 CSS 和 JavaScript 文件包含到 Angular 应用程序的 HTML 模板中.

Then, include ngDialog's CSS and JavaScript file into the HTML template of the Angular application.

在文件config/env/all.js中,找到assets.lib.css,追加'public/lib/ngDialog/css/ngDialog.min.css' 到列表中.

In file config/env/all.js, find assets.lib.css, append 'public/lib/ngDialog/css/ngDialog.min.css' to the list.

在同一个文件中,找到assets.lib.js,将'public/lib/ngDialog/js/ngDialog.min.js'追加到列表中.

In the same file, find assets.lib.js, append 'public/lib/ngDialog/js/ngDialog.min.js' to the list.

这篇关于mean.js 应用程序中的 ngDialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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