Solved

TextBox AngularjS

Posted on 2014-09-11
8
243 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
 

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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to dynamically set the form action using jQuery.

758 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

21 Experts available now in Live!

Get 1:1 Help Now