将焦点设置为Angular中的字段的简单方法

时间:2017-07-17 13:29:16

标签: angularjs

是否有一种简单的方法可以将焦点设置为Angular中的字段,还是必须编写一个大的> HCI Event: LE Meta Event (0x3e) plen 43 [hci1] 0.775003 LE Advertising Report (0x02) Num reports: 1 Event type: Non connectable undirected - ADV_NONCONN_IND (0x03) Address type: Random (0x01) Address: 27:40:9B:C3:23:7D (Non-Resolvable) Data length: 31 Company: Microsoft (6) Data: 010920005a6710df0df2265a4f2c5529c9cf62dfe7427b9f31f2ae RSSI: -87 dBm (0xa9) > HCI Event: LE Meta Event (0x3e) plen 43 [hci1] 1.524064 LE Advertising Report (0x02) Num reports: 1 Event type: Non connectable undirected - ADV_NONCONN_IND (0x03) Address type: Public (0x00) Address: A0:E6:F8:48:EF:78 (Texas Instruments Inc) Data length: 31 Flags: 0x05 LE Limited Discoverable Mode BR/EDR Not Supported Company: not assigned (30816) Data: ef48f8e6a000 128-bit Service UUIDs (complete): 1 entry 32f9169f-4feb-4883-ade6-1f0127018db3 RSSI: -73 dBm (0xb7) > HCI Event: LE Meta Event (0x3e) plen 43 [hci1] 2.375147 LE Advertising Report (0x02) Num reports: 1 Event type: Non connectable undirected - ADV_NONCONN_IND (0x03) Address type: Random (0x01) Address: 33:02:7C:4A:D6:FC (Non-Resolvable) Data length: 31 Company: Microsoft (6) Data: 01092000de74c964f3b4a3a59fde73f2c0c29651b9532a0e88c4e4 RSSI: -79 dBm (0xb1) > HCI Event: LE Meta Event (0x3e) plen 43 [hci1] 2.876845 LE Advertising Report (0x02) Num reports: 1 Event type: Non connectable undirected - ADV_NONCONN_IND (0x03) Address type: Public (0x00) Address: A0:E6:F8:48:F1:AF (Texas Instruments Inc) Data length: 31 Flags: 0x05 LE Limited Discoverable Mode BR/EDR Not Supported Company: not assigned (44896) Data: f148f8e6a000 128-bit Service UUIDs (complete): 1 entry 32f9169f-4feb-4883-ade6-1f0127018db3 RSSI: -73 dBm (0xb7) > HCI Event: LE Meta Event (0x3e) plen 12 [hci1] 2.891581 LE Advertising Report (0x02) Num reports: 1 Event type: Scan response - SCAN_RSP (0x04) Address type: Random (0x01) Address: 6B:AB:CD:7F:B7:65 (Resolvable) Data length: 0 RSSI: -91 dBm (0xa5) 脚本?

这是我的页面

$scope.$watch.$element

这是我的控制器

<input type="text" ng-model="vm.agency" id="agency" aria-invalid="false">

1 个答案:

答案 0 :(得分:1)

你可以试试这个: -

if (!vm.agency) {
    toaster.error({title: "MISSING AGENCY", body:"You must write the Agency name"});
    angular.element("#agency").focus();
    return;
}