Solved

Two TextBox and a Button AngularjS

Posted on 2014-09-19
2
1,762 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
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 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

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

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
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…
The viewer will learn how to count occurrences of each item in an array.

895 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

14 Experts available now in Live!

Get 1:1 Help Now