How to dynamically create text box when we click on a link using angularjs

MandaliVenkat picture MandaliVenkat · Apr 17, 2015 · Viewed 7.6k times · Source
  • I have a problem to show INPUT field when do some action.

    • I have BUTTON (Click here) as soon as user made a click event on button i wanted to show input field
    • I have done this by using jQuery.

    Can any one help me in Angular.js

Answer

Sarkhan picture Sarkhan · Apr 17, 2015
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
    $scope.boxShow = false;
});
</script>
<div ng-app="myApp">
    <div ng-controller="myCtrl">
        <a href="#" ng-click="boxShow=!boxShow">show box</a>

        <div ng-show="boxShow">
            <textarea rows="4" cols="50">text</textarea>
        </div>
    </div>
</div>

https://jsfiddle.net/bxwjpmaa/1/