我要求在单击元素(Button)时应该更改另一个元素属性.我可以通过jquery来做.但我想忽略我的角度项目中的jquery.
在Html中,
<input type=password />
<button ngclick="changeToTxt()">Change type password to text</button>
Run Code Online (Sandbox Code Playgroud)
在控制器中,
app.controller('loginPage', function ($scope) {
$scope.changeToTxt = function () {
**// need to get the password element and need to change type = text.....**
}
});
Run Code Online (Sandbox Code Playgroud)
在控制器中有没有办法(或不同/最好的方式)?或者需要为此编写指令?