两周前我开始使用AngularJS,我有一点问题。我想在我的网站中使用waypoint,但我不想只使用jQuery angularJS。
事实上,我试图使用它:https://github.com/zumba/angular-waypoints
但它对我不起作用我"Uncaught Error: [$injector:modulerr]"
在我的angularjs脚本中插入['zumba.angular-waypoints']
。
我不明白为什么它不起作用:/为什么?
ps:这是我的代码:
<li>
<a ng-click="replaceCurrentMenu('menu1')" ng-class="{current:isCurrentMenu('menu1')}" class="scroll" href="#menu1" title="Menu1">Menu1</a>
</li>
<li>
<a ng-click="replaceCurrentMenu('menu2')" ng-class="{current:isCurrentMenu('menu2')}" class="scroll" href="#menu2" title="Menu3">Menu2</a>
</li>
<li>
<a ng-click="replaceCurrentMenu('menu3')" ng-class="{current:isCurrentMenu('menu3')}" class="scroll" href="#menu3" title="Menu3">Menu3</a>
</li>
<li ng-show="showMenu2">
<a ng-click="replaceCurrentMenu('menu4')" ng-class="{current:isCurrentMenu('menu4')||waypoints.flags.on" class="scroll" href="#menu4" title="Menu4">Menu4</a>
</li>
<section zum-waypoint="waypoints" down="flags.on" up="flags.off" offset="20%" id="/menu4">
</section>
和我的代码angularjs:
(function(angular) {
'use strict';
var myApp = angular.module('Application_Teevity', ['zumba.angular-waypoints']);
//'ui.boostrap''zumba.angular-waypoints'
myApp.controller('ImageController', ['$scope', '$window', '$location', '$document', function($scope,$window,$location,$document) {
var menuCurrent = "menu1";
var hash = $window.location.hash;
if(hash.charAt(0)=='#') { hash = hash.substring(1);}
$scope.showMenu2 = false;
$scope.replaceCurrentMenu = function (menu) {
menuCurrent = menu;
}
$scope.isCurrentMenu = function (menu) {
return menuCurrent == menu;
}
$scope.showMenu2 = function() {
$scope.background = "#EFEFEF";
$scope.showMenu2 = true;
}
}]);
})(window.angular);