我正在使用Ionic Framework爲移動設備創建單頁應用程序。我有一個基於標籤的配置文件頁面結構。在「Home」視圖中,我點擊一個鏈接「Edit Profile」,它應該通過ProfileManagementController.js導航到editprofile.html。當我點擊它時,沒有任何反應,也沒有錯誤顯示在控制檯中。只有地址欄中的網址纔會更新。
這裏是app.js途徑編碼:
.state('editProfile', {
url: '/editProfile',
views: {
'tab-editprofile': {
templateUrl: 'templates/profile/editprofile.html',
controller: 'ProfileManagementController'
}
}
})
這在ProfileManagementController.js剪斷有關此功能:
$scope.goToEditProfile = function(path)
{
$state.go(path);
}
這是首頁標籤查看HTML形式(tab-home.html),其中按鈕存在導航到編輯配置文件:
<div>
Name: {{tempUserObject.name}} <br/>
Friends: {{tempUserObject.totalFriends}}<br/>
Mobile: {{tempUserObject.mobile}}<br/>
Username: {{tempUserObject.username}} <br/>
<br/>
<button ng-click="goToEditProfile('editProfile')" class="button">Edit Profile</button>
</div>
這是在原來的網址,當我在製表home.html的,點擊按鈕後第一個土地不起作用:
前:http://127.0.0.1:49259/index.html#/tab/home 後:http://127.0.0.1:49259/index.html#/editProfile
請幫助指導我找出這個鏈接出了什麼問題。我以前在其他地方使用過$ state.go,並且運行良好。
更新:editprofile.html添加。
<ion-view hide-nav-bar="false" title="Edit Profile">
<ion-content padding="'true'" class="has-header">
<div class="spacer" style="width: 300px; height: 87px;"></div>
<div class="button-bar"></div>
<h2>Edit Profile</h2>
</ion-content>
</ion-view>
不將其改爲相對路徑工作?即'ng-click =「goToEditProfile('^。editProfile')」' – potatopeelings
@potatopeelings已經嘗試過,並且它不會 –