rbhargaw
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>
ASKER
I have added this line in parent controller, but how do I pass this subID to different view?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
<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
ASKER
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('DemoPa ge1Control ler', function ($scope, $location, $routeParams, $resource, $http) {
}
but it's not even hitting the JS file, any ideas?
I added this route information
.when('/demoPage1/:subID',
and then javascript file as
appRoot.controller('DemoPa
}
but it's not even hitting the JS file, any ideas?
no sorry
ASKER
Thanks! Anyways my original problem is solved so will close this ticket
so declare subID in a parent scope (controller)
$scope.subID = "";