Link to home
Start Free TrialLog in
Avatar of rbhargaw
rbhargawFlag for United States of America

asked on

TextBox AngularjS

I have an Input textbox where I will enter some value. After I click on search, I want to go to next page with the User details. I can get the value using http and show in same view but how do I show the values on another view?

<div>
        <h2>Search by Number</h2>
        <input type="text" id="prodId" data-ng-model="subID" size="5" />
         <a href="#/contact/" class="btn btn-lg " >Search</a>
         </div>

Open in new window

Avatar of leakim971
leakim971
Flag of Guadeloupe image

use a parent scope
so declare subID in a parent scope (controller)

$scope.subID = "";
Avatar of rbhargaw

ASKER

I have added this line in parent controller, but how do I pass this subID to different view?
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
<a href="#/contact/{{subID}}" class="btn btn-lg " >Search</a>  and now it shows the subID in the link. Does this seems right?
use ng-href
Thanks! Now I get this link http://localhost:4416/#/demoPage1/374791 as you would notice 374791 is the subID.

I added  this route information
.when('/demoPage1/:subID', { templateUrls: '/home/demoPage1', controller: 'DemoPage1Controller' })

and then javascript file as


appRoot.controller('DemoPage1Controller', function ($scope, $location, $routeParams, $resource, $http) {

}

but it's not even hitting the JS file, any ideas?
no sorry
Thanks! Anyways my original problem is solved so will close this ticket