Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Two TextBox and a Button AngularjS

Posted on 2014-09-19
2
Medium Priority
?
1,978 Views
Last Modified: 2014-09-19
I have two textboxes one is Snumber and another dNumber and one FIND button. What I want is if I am entering sNumber, then button click goes to a page and if I enter dNumber then button click go to another page. How can this be done in AngularJS?

             
                 <div class="form-group">
                                 <label class="control-label">S Number</label>
                                 <div class="form-group">
                                    <input type="text" class="form-control"  data-ng-model="sNumber" >
                                 </div>
                              </div>
                              <div class="form-group">
                                 <label class="control-label">D Number</label>
                                 <div class="orm form-group">
                                    <input type="text" class="form-control" data-ng-model="dNumber" data-ng-maxlength=20 data-ng-minlength=5  required>
                                 </div>
                              </div>
                           </div>
                        </form>
                        <div class="form-actions">
                           <a data-ng-href="#/sDetailsList/{{sNumber}}" class="btn btn-lg green" >Find Data(s)</a>
			   <a data-ng-href="#/dDeatilsList/{{dNumber}}" class="btn btn-lg green" >Find Data(s)</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
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 40333660
hope that help : http://jsfiddle.net/2m3o6tsc/

Using : ng-hide="!dNumber||sNumber.length" and ng-hide="!sNumber||dNumber.length"

<div ng-app="myApp" ng-controller="myCtrl">
    <form>
        <div>
            <div class="form-group">
                <label class="control-label">S Number</label>
                    <div class="form-group">
                        <input type="text" class="form-control"  data-ng-model="sNumber" ng-disabled="dNumber.length" />
                    </div>
            </div>
            <div class="form-group">
                <label class="control-label">D Number</label>
                <div class="orm form-group">
                    <input type="text" class="form-control" data-ng-model="dNumber" data-ng-maxlength=20 data-ng-minlength=5 ng-disabled="sNumber.length"  required />
                </div>
            </div>
        </div>
    </form>
    <div class="form-actions">
        <a data-ng-href="#/sDetailsList/{{sNumber}}" class="btn btn-lg green" ng-hide="!sNumber||dNumber.length" >Find Data(s)</a>
        <a data-ng-href="#/dDeatilsList/{{dNumber}}" class="btn btn-lg green" ng-hide="!dNumber||sNumber.length" >Find Data(s)</a>
    </div>
</div>

Open in new window

0
 

Author Comment

by:rbhargaw
ID: 40333713
That's exactly what I needed! Thanks!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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.
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 lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

715 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