$ionicHistory 定義:
$ ionicHistory在用戶瀏覽應(yīng)用程序時(shí)跟蹤頁面。獲取頁面信息,進(jìn)行頁面跳轉(zhuǎn)操作。
特點(diǎn):Should a user navigate few pages deep on one tab, and then switch to a new tab and back, the back button relates not to the previous tab, but to the previous pages visited within that tab.記錄歷史界面,而不會(huì)在兩個(gè)界面中來回返回。
方法列表:
viewHistory()
返回該應(yīng)用程序的視圖歷史數(shù)據(jù)堕花,如所有的視圖和歷史記錄
Returns: object
Returns an object containing the apps view history data.
currentView()
該應(yīng)用程序的當(dāng)前視圖。
Returns: object
Returns the current view.
currentHistoryId()
歷史堆棧的ID粥鞋,它是當(dāng)前視圖的上一級視圖缘挽。
Returns: string
Returns the current history ID.
currentTitle([val])
獲取并設(shè)置當(dāng)前視圖的標(biāo)題。
Returns: string
Returns the current view's title.
backView()
返回歷史堆棧中當(dāng)前視圖之前的視圖陷虎。如果用戶從視圖A導(dǎo)航到視圖B到踏,則視圖A將是back view,視圖B將是當(dāng)前視圖尚猿。Returns: object
Returns the back view.
backTitle()
獲取下級視圖的標(biāo)題窝稿。
Returns: string
Returns the back view's title.
forwardView()
返回歷史堆棧中當(dāng)前視圖前面的視圖。如果用戶從視圖A導(dǎo)航到視圖B凿掂,然后導(dǎo)航回視圖A伴榔,則存在orward view。此時(shí)庄萎,視圖B將是orward view,踪少,視圖A將是當(dāng)前視圖。
Returns: object
Returns the forward view.
currentStateName()
返回當(dāng)前狀態(tài)名稱糠涛。
Returns: string
goBack([backCount])
如果存在back view援奢,則將App導(dǎo)航到back view。
backCount(可選的)忍捡,默認(rèn)為 -1集漾。
可選的負(fù)整數(shù)設(shè)置要返回的視圖數(shù)切黔。默認(rèn)情況下,它將使用該值返回一個(gè)視圖 -1具篇。要返回兩個(gè)視圖就使用 -2纬霞。
如果數(shù)字比當(dāng)前歷史記錄堆棧中的視圖數(shù)量更遠(yuǎn),那么它將轉(zhuǎn)到當(dāng)前歷史記錄堆棧中的首頁驱显。
如果數(shù)字為零或更大诗芜,那么它什么都不做。
clearHistory()
清除App當(dāng)前視圖外的所有頁面歷史記錄埃疫。
clearCache()
清除緩存伏恐。
nextViewOptions()
設(shè)置下一個(gè)視圖的一些功能。
可用選項(xiàng):
- disableAnimate:不要為下一次跳轉(zhuǎn)頁面制作動(dòng)畫熔恢。
- disableBack:下一個(gè)頁面應(yīng)該忘記它的back view脐湾,并將其設(shè)置為null。
- historyRoot:下一個(gè)頁面會(huì)變成其歷史堆棧中的根視圖叙淌。
舉例:
$ionicHistory.nextViewOptions({
disableAnimate: true,
disableBack: true
});