![](/img/trans.png)
[英]Fancybox: link that changes the url in address bar and links to a page with an open Fancybox
[英]Navigates of page programmatically but address bar URL doesn't changes
我使用的是J-Query Mobile
和AngularJS
,在按下的鏈接上,我想將用戶導航到它導航的其他頁面,但是地址欄中的url地址不會更改解決此問題的方式。 我會使用單頁結構
HTML部分
<a href="" ng-controller="addFoodToLog" ng-click="go()" data-role="button">Add To Log</a>
JS部分
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');
}
});
我解決了我的問題
如果您使用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');
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.