javascript - only show button if input fields are not empty and one has valid URL -
i have following code , works fine check if input field "inputurl" has valid url, if has anchor link a.btn
shows fine want show if both have been filled in. how can add ng-show
in anchor this?
<form name="myform" class="row inputs"> <div class="col-xs-5"> <label for="exampleinputpassword1">enter title/description</label> <input type="text" id="urlname" class="form-control" placeholder="" ng-model="mvname" > </div> <div class="col-xs-5"> <label for="exampleinputpassword1">enter url</label> <input type="url" name="inputurl" id="urllink" class="form-control" placeholder="" ng-model="mvurl" > </div> <div class="col-xs-2"> <a href="javascript:" ng-click="savetolist($event)" class="btn btn-block post" ng-show="myform.inputurl.$valid ">post</a> </div> </form>
you can check if both have been filled model this:
ng-show="myform.inputurl.$valid && mvname && nvurl"
or view value of input
ng-show="myform.inputurl.$valid && myform.inputurl.$viewvalue && myform.urlname.$viewvalue"
Comments
Post a Comment