.
run
(
function
(
$ionicPlatform
,
$rootScope
,
$ionicHistory
,
$state
)
{
var
needLoginView
=
[
"myclass"
,
"mycomment"
,
"myfavorite"
,
"myquestion"
,
"orderlist"
]
;
$rootScope
.
$on
(
'$stateChangeStart'
,
function
(
event
,
toState
,
toParams
,
fromState
,
fromParams
,
options
)
{
if
(
needLoginView
.
indexOf
(
toState
.
name
)
>=
0
&&!
$rootScope
.
isLogin
)
{
$state
.
go
(
"login"
)
;
event
.
preventDefault
(
)
;
}
})})
;