Solved

TextBox AngularjS

Posted on 2014-09-11
8
247 Views
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?

<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

0
Comment
Question by:rbhargaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 82

Expert Comment

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

$scope.subID = "";
0
 

Author Comment

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

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40318017
did you just try : $scope.subID ?
I should work if the views are childrens
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:rbhargaw
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?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 40318066
use ng-href
0
 

Author Comment

by:rbhargaw
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?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 40318227
no sorry
0
 

Author Comment

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

749 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