Angular X-editable set焦点事件

时间:2016-02-10 16:58:06

标签: javascript angularjs x-editable

我正在使用angular-xeditable api。你可以告诉我如何在表单'加载'时将setfocus设置到控件中并按'添加行'按钮吗?

JsFiddle

在上面的api上有一个名为$activate(name)的方法。但我不知道如何在上述场景中使用它。谢谢。

 // add user
  $scope.addUser = function() {
    $scope.users.push({
      id: $scope.users.length+1,
      name: '',
      status: null,
      group: null,
      isNew: true
    });
  };

pic

1 个答案:

答案 0 :(得分:3)

Here is a fiddle with what I came up with to fix your problem.

I added a setFocus function call in the addUser method

Sub TestError()
    On Error GoTo errError
lblError:
    On Error GoTo errError
    'Code that should raise an error and send to errError
    Excel.Application.Workbooks.Open ("lakdfjldkj")
    Exit Sub
errError:
    MsgBox "Code didn't break"
    GoTo lblError
End Sub