Solved

TextBox AngularjS

Posted on 2014-09-11
8
246 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
  • 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lazy load not working with masonry js 1 20
Passport Expiry 3 49
Gotten a bit confused with my rather simple PowerShell script 3 21
innerHTML 7 23
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

825 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