我有我的角度應用程序使用路由和兩個視圖。從視圖2到視圖1的角度鏈接不刷新頁面
當第二個觀點,我只是試圖重新添加一個鏈接以查看1,即「返回首頁」
我嘗試了以下內容和它的作品ofcourse,但它的作用就像一個正常的href和刷新頁
<a href="/">Back to Search</a>
如何添加一個沒有完整頁面刷新但只是改變視圖的鏈接?
編輯添加了路由配置
app.config(['$routeProvider','$locationProvider', function($routeProvider,$locationProvider){
$routeProvider
.when('/',{
templateUrl: '/views/main.html',
controller : 'SearchCtrl'
})
.when('/result',{
templateUrl: '/views/result.html',
controller : 'resultCtrl'
})
.otherwise({
redirectTo : '/'
});
}]);
什麼是寫你的網頁在你的路線供應商/供應商的狀態(「/」)? – 2014-12-02 11:17:03
你需要處理這種情況,以及在你的路線提供者。當選項 – Kop4lyf 2014-12-02 11:17:46
看起來像我必須像這樣添加「" to stop the full refresh when im back in the root..is this normal ? – StevieB 2014-12-02 11:37:01