为什么我得到的错误模块在JSFiddle中不可用? [英] Why I get error module not available in JSFiddle?
本文介绍了为什么我得到的错误模块在JSFiddle中不可用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我声明了这个模块:
angular.module('dashboard', [])
.controller('dashboardController', ['$scope',
function ($scope) {
$scope.data = "555";
}]);
这是视图:
<div ng-app="dashboard" data-role="page" id="layersProperty" data-add-back-btn="true" >
<div ng-controller="dashboardController">
{{data}}
</div>
</div>
这是 FIDDLE .
在控制台中,我收到此错误:
In console I get this error:
错误:[$ injector:nomod]模块'dashboard'不可用!您可能拼错了模块名称,或者忘记了加载它.如果要注册模块,请确保将依赖项指定为第二个参数.
Error: [$injector:nomod] Module 'dashboard' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
知道为什么我会在上面出现错误吗?
Any idea why I get error above?
推荐答案
代码没有问题,因为您要添加外部脚本,因此只需更改
No issue with your code, since you are adding external scripts you just need to change
Javascript settings -> Load type -> Wrap in <Head>
Javascript settings -> Load type -> Wrap in <Head>
这篇关于为什么我得到的错误模块在JSFiddle中不可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文