AngularJS: Uncaught Error: No module: GridCambiable
AngularJS: Uncaught Error: No module: GridCambiable
我正在尝试遵循我在这里找到的教程和演示http://jsfiddle.net/scyrizales/pC9dH/
因此,这是我所做的代码片段
<div ng-app="GridCambiable" ng-controller="GridCambiableController">
<div class="bar">
<!-- These two buttons switch the layout varaible,
which causes the correct UL to be shown. -->
<a class="list-icon" ng-class="{active: isLayout('list')}" ng-click="setLayout('list')"></a>
<a class="grid-icon" ng-class="{active: isLayout('grid')}" ng-click="setLayout('grid')"></a>
</div>
<!-- We have two layouts. We choose which one to show depending on the "layout" binding -->
<ul ng-show="isLayout('grid')" class="grid">
<!-- A view with big photos and no text -->
<li ng-repeat="p in pics">
<a href="{{p.link}}" target="_blank"><img ng-src="{{p.images.low_resolution.url}}" /></a>
</li>
</ul>
<ul ng-show="isLayout('list')" class="list">
<!-- A compact view smaller photos and titles -->
<li ng-repeat="p in pics">
<a href="{{p.link}}" target="_blank"><img ng-src="{{p.images.thumbnail.url}}" /></a>
<p>{{p.caption.text}}</p>
</li>
</ul>
<标题> app.controller('GridCambiableController', ['$scope', 'instagram' ,
function ($scope, instagram){
// Layout por defecto
$scope.layout = 'grid';
$scope.setLayout = function(layout){
$scope.layout = layout;
};
$scope.isLayout = function(layout){
return $scope.layout == layout;
};
当我启动代码时,我在我的chrome控制台得到这个错误
Uncaught Error: No module: GridCambiable
我的尝试失败了http://plnkr.co/edit/9BYKw45ZrIgVpbixRsAz?p=preview 请问为什么我在我的控制台上得到这个。谢谢。
标题>您在包含angular.min.js
之后没有包含script.js
在你的index.html:
<!--include angular-->
<script src="script.js"></script>
在控制器前添加:
var app = angular。模块("GridCambiable",[]);
替代:角。模块("GridCambiable",[])。controller('GridCambiableController', ['$scope', 'instagram',函数($scope, instagram){
// Layout por defecto
$scope.layout = 'grid';
$scope.setLayout = function(layout){
$scope.layout = layout;
};
$scope.isLayout = function(layout){
return $scope.layout == layout;
};
相关文章:
- 为什么要对define.md和module.exports进行条件检查,以及条件何时通过
- Module.start()已激发两次
- module.js在运行iron节点时找不到模块
- ES6to5, ES6 Module Transpiler and Babel
- 在jasmine规范中使用module.exports
- 我们可以在一个js文件中有多个module.exports语句吗
- module.exports一个jQuery插件
- “module.exports.instance”是什么意思
- Module.exports通过Mongoose调用返回undefined
- 我可以在Node中以编程方式更改.js文件的module.exports中的JSON对象吗
- 使用module.exports和ES6导出导入
- 调用module.exports上的函数时发生CommonJS非法调用错误
- 如何从module.exports访问函数
- 为什么在定义导出属性之前调用module.exports时仍然有效
- 使用angular.module创建控制器有什么好处(如果有的话)
- 如何在mocha测试中模拟全局变量(define、module、window)
- $(this) in JavaScript Module Pattern
- react-css-module module not found
- 使用 Angular.Module 的 AngularJS 指令定义
- AngularJS: Uncaught Error: No module: GridCambiable