icanbeacoder
icanbeacoder

Reputation: 1388

Angularjs Hide the text inside input field

I(fairly new to angular) am working on angularjs terminal emulator, Here's the plunk http://plnkr.co/edit/BzLc9WGakUcRX5Cn2LpE?p=preview

What I want is that text inside input field should not be visible as I type in the input and the model should get updated to whatever text I type without being shown.

Is there any filter to hide the text only.

Upvotes: 2

Views: 1755

Answers (1)

cardeol
cardeol

Reputation: 2238

This is a working example of what you want (I have changed the angular version to get ng-keyup working)

<!doctype html>
<html>
<head>
  <script src="http://code.angularjs.org/1.2.3/angular.min.js"></script>
  <script src="example.js"></script>
  <style>
    #hidden {
      border: 0;
      margin: 0;
    }
  </style>
</head>
<body ng-app="plunker">
  <div ng-controller="terminalCtrl">
    <div ng-repeat="line in terminal">
      <div>
        {{line}}
      </div>
    </div>
    ><input ng-keyup="changeKey($event)" ng-model="command" id="hidden">      
  </div>
</body>
</html>

example.js

var app = angular.module('plunker', []);
app.controller('terminalCtrl', function($scope) {
  $scope.terminal = [];
  $scope.terminal.push("line 1 example");
  $scope.changeKey = function(event) {
    if (event.keyCode == 13) {
      $scope.terminal.push($scope.command);
      $scope.command = "";
    }
  };
});

Upvotes: 2

Related Questions