【发布时间】:2015-07-22 07:00:15
【问题描述】:
**HTML**
<div ng-app="myApp" ng-controller="myCtrl">
<input placeholder="Enter your teams name" ng-model="team_input" ng-show="myVar" ng-focus="true" class="team_input" ng-class="{redPlaceholder : newteamfocus, whitePlaceholder : !newteamfocus}" ng-blur="newteamfocus=true" type="text" name="team_input" autofocus required/>
<button ng-click="toggleTeamField()">Add New</button>
</div>
**JS**
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.myVar = false;
$scope.toggleTeamField = function() {
$scope.myVar = !$scope.myVar;
$scope.newteamfocus = false;
$scope.team_input = "";
};
});
在这里我可以显示隐藏的输入框,但是当我单击添加按钮时,闪烁的光标没有出现。如何在输入框中显示闪烁光标。 Plunker
【问题讨论】:
-
@JafferWilson 。凉爽的。这是由 jquery 完成的。不使用 angular.js
-
@RameshRajendran 你在说什么,我没听懂?
标签: angularjs angularjs-directive angularjs-scope