我是Angular JS的新手,我目前正在尝试制作混合网络应用。我需要使用某种按键功能,当我点击输入标签上的输入时,它会进入下一页。到目前为止,我有以下内容:
<label class="item item-input" style="width: 80%; margin:0 auto;">
<input ng-model="name" type="text" placeholder="Enter your name"> </input>
</label>
答案 0 :(得分:0)
您可以使用ng-keypress
指令。 https://docs.angularjs.org/api/ng/directive/ngKeypress
因此,在input
上添加ng-keypress="redirectMe($event)"
在你的控制器中,
$scope.redirectMe = function(evt){
if (evt.which === 13) { $location.path( "/yournextpage" ); }
}
答案 1 :(得分:0)
您可以使用指令
HTML:
<button ng-enter="doAction(namePage)" ></button>