Modifying the DOM with instructions

Source: Internet
Author: User

For the Html5,input element has the autofocus this attribute, the user can interact with the user when the first time enters the interface, for the browser, may

Positioning the keyboard focus on an element, but for non-input elements, we can use directives to achieve focus positioning.

1:html file:

2:autofocus.js Directive File

3:directctrl.js Controller Files

(function() {    ' use strict ';     var mymodule = angular.module (' Mydirectapp ', []);    Mymodule.controller (' Directcontroller ', [' $scope ',function($scope) {        = ' No click! ';                 function () {            = ' When you click Confirm! ';        };                 function () {            = ' click Reset! ' ;        };    }]);}) ();

Note: In the main Page load JS file, to load the Autofocus.js file first, and then load the Directctrl.js file, otherwise it will be an error.

angular-1.3.8.js:11594 Error: [ng:areq] Argument ' Directcontroller ' is not a function, got undefined

This controller is not recognized.

Modifying the DOM with instructions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.