Multi- step verification [urgent! Please reply]


#1

Please help me out ! i am stuck !

I have three steps verification and i need to protect the other states until the whole verification is complete !

Can anyone explain how to protect states ? I tried using resolve but any state change function called from resolve does not work ! ?

Can somebody please explain a simple idea of how to protect states ?


#2

Do you want to protect views or states?


#3

@bengtler sorry ! states !


#4

okay,

you could add custom states params.
In your routings (state definitions like .state(’’, {})

you can add own keys:
like verificationRequired: true

Then add a service, where you store, if the verification is ready.
Listen in your Base-Controller on each stateChange -> if that state has verificationRequired = true -> check if you are really verified.

If not -> redirect to the verification state.

Summary:

  1. parameter for your state

    .state(‘verState’, {
    url: ‘xxxx’,
    views: {},
    requiredVerification: true
    })

  2. service or $rootScope to set a variable, if the verification is complete

  3. https://github.com/angular-ui/ui-router/wiki#state-change-events
    use the state events to get from and toState and check verification and so on
    -> do or not do the redirect.

greetz


#5

can you please share a working example ? or a link ?
@bengtler

I am currently using the state change event but its too much code inside it ! because i need toprotect many states !