angularjsformsangular-ui-routernested-views

Angular UI-Router: display a view when form is submitted


I have a plunker at here , which includes a form on the left. When the form is submitted, I wish to display the results as a ui-view on the right column. I use the ui-router to do this in the vm.search() function associated to the search button:

$state.href('/results');

however, the results page does not get loaded when the form is submitted. Could someone point me to the right direction for research or give me some quick hints/answers? I appreciate it


Solution

  • The problem was with the href usage, if you use go it works:

    $state.go('formResult'); //display the results page
    

    $state.href -

    A url generation method that returns the compiled url for the given state populated with the given params.

    Example:

    $state.href("about.person", { person: "bob" }) == "/about/bob"