Solved

Two TextBox and a Button AngularjS

Posted on 2014-09-19
2
1,933 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 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

627 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