TextBox AngularjS

Posted on 2014-09-11
Last Modified: 2014-09-11
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?

        <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>

Open in new window

Question by:rbhargaw
  • 4
  • 4
LVL 82

Expert Comment

ID: 40317971
use a parent scope
so declare subID in a parent scope (controller)

$scope.subID = "";

Author Comment

ID: 40317985
I have added this line in parent controller, but how do I pass this subID to different view?
LVL 82

Accepted Solution

leakim971 earned 500 total points
ID: 40318017
did you just try : $scope.subID ?
I should work if the views are childrens

Author Comment

ID: 40318055
<a href="#/contact/{{subID}}" class="btn btn-lg " >Search</a>  and now it shows the subID in the link. Does this seems right?
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

LVL 82

Expert Comment

ID: 40318066
use ng-href

Author Comment

ID: 40318100
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?
LVL 82

Expert Comment

ID: 40318227
no sorry

Author Comment

ID: 40318276
Thanks! Anyways my original problem is solved so will close this ticket

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how can display objects ? 3 24
Check if Object property exists? 3 19
Auto-indent certain lines in Notepad++ 10 32
what is the difference between call and apply 1 26
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now