问题标签 [angular-module]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
angularjs - 如何在角度中找到失败的导入源的位置
我继承了一个大型 Angular 代码库,当我运行它时(如果需要,使用 gulp),页面部分加载,并且查看开发面板显示模块无法加载。
这是跟踪:
错误:[$injector:modulerr] 无法实例化模块应用程序,原因是:
[$injector:modulerr] 无法实例化模块 app.someModule,原因
是:[$injector:nomod] 模块“app.someModule”不可用!您要么拼错了模块名称,要么忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数。
http://errors.angularjs.org/1.4.7/ $injector/nomod?p0=app.someModule
minErr/<@ http://localhost:3000/bower_components/angular/angular.js:68:12
module/< @ http://localhost:3000/bower_components/angular/angular.js:1986:1
确保@ http://localhost:3000/bower_components/angular/angular.js:1910:38
模块@http://localhost:3000/bower_components/angular/angular.js:1984:1
loadModules/<@ http://localhost:3000/bower_components/angular /angular.js:4390:22
forEach@ http://localhost: 3000/bower_components/angular/angular.js:336:11
loadModules@ http://localhost:3000/bower_components/angular /angular.js:4374:5
loadModules/<@ http://localhost:3000/bower_components/ang
有没有办法找出角度试图从哪里找到模块(即模块代码或隐式依赖该代码的代码)?
对于它的价值,对“someModule”的简单文本搜索会返回太多点击。
angularjs - 如何创建一个简单的仪表板角度小部件?
我为我的 Angular 应用程序安装了malhar-angular-dashboard模块,我想创建一个简单的小部件来显示一些虚拟文本。
HTML 视图
JavaScript
小部件模板
当我运行它时,我得到了这样的结果:
和错误
TypeError:_.merge 不是 Object.WidgetModel 中的函数(http://localhost:9000/bower_components/malhar-angular-dashboard/dist/malhar-angular-dashboard.js:848:42)
javascript - 拼写错误或缺少模块?
我有一个使用 AngularJS 的 ASP.NET MVC5 应用程序。在此,我有一个名为atTheMS
工厂的模块,用于调用服务albumService
和 3 个控制器:ListController
、EditController
和DetailsController
。服务和控制器都依赖于atTheMS
模块,但我只从albumService
它说它发生在(anonymous function) albumService.js:27
使用的其他文件不会发生该错误(angular.module("atTheMS"))
,这是复制我拥有的另一个工厂而生成的,除了单词“album”被单词“book”替换并且模块是“atTheLibrary”并且没有当我在该页面上时出现错误。我很困惑为什么这会有所不同。任何帮助将不胜感激,谢谢。
根据要求,这是视图:
javascript - 如何在 malhar 角度小部件上保存样式更改?
我在 AngularJS 应用程序中安装了malhar-angular-dashboard模块。我配置了一个显式保存的布局。问题是我无法弄清楚如何保存小部件样式更改。关闭模型设置窗口后,我想更改并保存contentStyle的背景(背景:红色)
JavaScript
arrays - 如何在 malhar-angular-dashboard 中返回带有数据服务的 widgetDefinitions?
我已经安装了malhar-angular-dashboard模块。我不想硬编码我的widgetDefinitions,所以我创建了一个服务女巫,它将返回带有小部件对象的数组。我正在使用休息服务来返回小部件名称、标题等数据。问题是我收到此错误并且不知道如何解决:
TypeError:widgetDefs.map 不是函数
服务数据
}]);
小部件定义服务
安慰
TypeError:widgetDefs.map 不是函数
widgetDefs:[对象,对象,对象]
小部件定义:[对象,对象,对象]
笔记
如果我像这样对我的 widgetDefinitions-service 返回的数组进行硬编码,它可以工作,如果我用我的休息服务返回不起作用(widgetDefs.map 不是一个函数):
angularjs - 如何通过休息客户端在 Malhar 角度仪表板中动态设置 de widgetDefinitions?
我已经安装了malhar-angular-dashboard模块,我想用我的休息数据填充一些widgetDefinitions 。
HTML
小部件RestService
我的休息服务返回给我这个包含 3 个对象的数组:[{"name":"widgetList","title":" "},{"name":"widgetPie","title":" "},{"name":"widgetTable","title":" "}]
其他服务
控制器
结果
TypeError:无法在Object.LayoutStorage(http://localhost:9000/ bower_components/malhar-angular-dashboard/dist/malhar-angular-dashboard.js:1064:15 )
我在第 2 行搜索:Object.LayoutStorage,我发现了这一点:
只有当我想在then回调函数中设置$scope.layoutOptions时,options变量才被定义。任何建议如何设置/避免这种情况?
angularjs - How to reload / recompile / refresh directive in AngularJs?
I have installed the malhar-angular-dashboard module for the purpose of using widgets. After I configure my options the dashboard-layouts directive works fine and is displaying my widgets in the view. If I change the options in my controller after the directive has compiled I get this error:
Widget fromTimeout is not found. undefined
HTML
Chose widget - button
JavaScript Controller
Running the application
Conclusion
When I trigger the click event from Chose widget the addWidgetInternal($event, widget) is executed witch is leading me to this problem in the dashboard-layout directive code:
I guess I need to recompile the directive in order to have access to my new changes I made from my controller. Any advice ?
c# - 发布站点时出现角度未知提供程序错误
我开发了一个小应用程序,现在我想第一次将它发布到天蓝色。
这是我第一次在任何项目中使用 Angular,但我出了点问题。我收到此错误:
错误:[$injector:unpr] 未知提供者:sProvider <- s <- MapController
这是我的控制器:
这是我的布局页面:
为什么我会得到这个角度错误?
** 编辑 ** 这是我加载脚本的包。
mapcontroller.js 是我所有的 angular/js 代码所在的位置。(不知道为什么我没有更改捆绑包的名称,猜我很懒)
angularjs - 有 2 个应用程序或一个具有多个模块的应用程序
我正在使用角度,我想知道哪个更好。我有我的模板,我将其拆分为页眉、页脚、侧边菜单和主要内容。我想知道是否每个部分使用一个模块,然后使用另一个模块来封装较小的模块,或者让每个模块具有不同的 ng-app 然后引导。我想知道性能和最佳实践方面的区别。
目前我已经用 UI-router 实现了如下: -
风景
路线:-
我有一个 base-profile-view.html,其中包含要注入的各个部分。他们每个人都有不同的模块。然后我将每个部分模块都包含在基本配置文件视图中
然后我有另一个包含 baseProfileModule 的主模块:-
现在我想知道这是一种很好的做事方式,或者还有其他更好的方法。
angularjs - AngularJs - 将子模块注入其他子模块
我有一个听起来可能很愚蠢的场景,但我被困住并试图了解可能导致它不起作用的原因。
我有一个角度应用程序,现在有三个模块
我在我的父模块(即 mainApp)中设置了一些配置和默认字符串,我想在它的所有子模块中使用它们。
另一方面,我的 reviewModule 和 searchmodule(子模块)有单独的控制器和服务,我在不同的路线上使用它们。现在,当我想将一个模块的服务用于另一个模块时,问题就来了,例如,如果我执行以下操作
在我的搜索模块控制器中使用 reviewModule 服务,我得到一个异常,说
两个子模块具有相同的父模块,我想将一个子模块用于另一个子模块,但不明白为什么会出现此异常。
更新:
我什至尝试使用下面的行进行模块声明
但这也会导致异常。