我正在使用J-Query Mobile
和AngularJS
并且在按下的链接上我希望将用户导航到导航的不同页面,但地址栏中的url地址不会更改如何解决此问题。我使用单页结构
HTML部分
<a href="" ng-controller="addFoodToLog" ng-click="go()" data-role="button">Add To Log</a>
JS Part
var myApp = angular.module('myApp',[]);
myApp.controller('addFoodToLog',function($scope){
$scope.go = function() {
//Here Selected Food Bump In Food Log
alert("Successfully Add In Your Log");
$.mobile.changePage('index.html#foodscreen');
}
});
答案 0 :(得分:0)
我解决了我的问题
如果您使用Angular-JS
,JQuery Mobile
和Angular JQM Adopter
,则可以通过更改代码来实现您的要求
myApp.controller('addFoodToLog',function($scope){
$scope.go = function() {
//Here Selected Food Bump In Food Log
alert("Successfully Add In Your Log");
$.mobile.changePage('index.html#foodscreen');
}
});
到此
myApp.controller('addFoodToLog',function($scope,$location){
$scope.go = function() {
//Here Selected Food Bump In Food Log
alert("Successfully Add In Your Log");
$location.hash('foodscreen');
}
});