2
我正在使用angularjs和jquery(對於菜單和更多),但我不知道爲什麼我不能讓jquery(eq。簡單手風琴菜單)像this一樣工作,都在<div ng-view>
我嘗試了所有方法,但並沒有工作,請幫我jquery不工作ngview裏面
這是我的角碼
var myApp = angular.module("myApp",['ngRoute']);
$url ="/load.php?stundent=<? echo $_GET["all"]; ?>";
myApp.factory('myService',function($http){
var getData = function() {
return $http({method:"GET", url:$url}).then(function(result){
return result.data;
});
};
return { getData: getData };
});
myApp.config(function($routeProvider) {
$routeProvider
.when('/', {
templateUrl : 'main.html',
controller : 'ItemsController'
})
// route for the home page
.when('/one', {
templateUrl : 'one.html',
controller : 'ItemsController'
})
// route for the about page
.when('/two', {
templateUrl : 'p/two.html',
controller : 'othercontroller'
});
});
myApp.controller('othercontroller', function othercontroller($scope,$http) {
...
});
myApp.controller('ItemsController', function ItemsController($scope,myService,$timeout,$http) {
...
}
如果你必須使用該jQuery(可以很容易地用角度來完成),你需要把它放在一個指令中。裏面的指令,你有權訪問主元素,它的後代 – charlietfl
什麼「它不工作」是什麼意思?請爲您的問題添加詳細信息,說明您希望代碼執行的內容以及實際執行的內容。 – Cristik
菜單不收縮,當我點擊什麼時候什麼也沒有發生 – jearca