angularjs - UI Router redirect on form success -


I use the UI router in my AngularJS app when the form is posted, then I want to load another page .

I have tried the code below. The console.lag (data) works fine, but nothing happens with $ state.go ('brand')

There is no error.

  $ http ({... .vivet (function) {console.log (data); $ state.go ('brand');})   

Update! Solution . The form submission was done in a model and was not hidden when a new page was loaded:

  $ ('# Confirm_delete'). ('Hide'); $ ('# confirm_delete'). ('Hidden.b.s.model', work (e) {$ state.go ("brand");})  

This scenario should work. Against < Code> UI-Router states. I made an example Or app.config (['$ stateProvider', function ($ state provider) {$ stateProvider .state ('main', {Url: '/', templateUrl} : "Tpl.main.html", Controller: 'Maincounting',}) .state ('Brand', {url: '/ Brand', Template: "

Lt; / p & gt;" })}]));

And here's a controller, with the send operation ... redirected to the brand state

  app.controller ('MainCtrl', [' $ Scope ', $ $ Http', '$ state', function ($ radius, $ http, $ state) {$ scope.user = {name: "John"} $ scope.send = function () {$ http Get ("Dummy.json", {params: $ scope.user}) .success (function (data) {$ state.go ("brand");})}}]));  

Check it and you will see that it's working (this model uses to send but ... this will apply to the post). Check it out


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -