Angularjs set focus on first textbox

Angularjs set focus on first textbox

Angularjs set focus on first textbox

In this Post We Will Explain About is Angularjs set focus on first textbox With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Angular js auto focus for input box Example

In this post we will show you Best way to implement How to set focus on first textbox of the page in angular, hear for Automatically Set Focus on a Textbox (Input Box) in AngularJS with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

  vue localStorage using Vuex Example

External Include file

AngularJS is a simple JavaScript framework Include one type of the (library) based on a very user friedly popular software mvc based architecture menas called the MVC.

   <head>
    <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>

    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>
</head>

index.html

The Angular simple directives and the User’s view HTML DOM in a web-application page form the HTML view. In our example(Pakainfo.com), the simple HTML view comprises the HTML All the element, and then simple two angular directives Like as a namely angular ng-app as well as agular ng-controller

<body>
<h1>Angularjs set focus on first textbox Example</h1>
    <div ng-app="liveApp" ng-controller="liveCtrl">
<!-- Devloped by http://pakainfo.com free download examples -->
        <p>
            <input type="text" id="date" datepicker ng-model="val_date" 
                placeholder="Select a any date" />
        </p>
        <p ng-if="val_date" ng-init="simpleSetFocus()">
            <input type="text" placeholder="Please Enter some value" id="t" />
        </p>
    </div>
</body>

index.js

The simple angular controller works as a all the data of the mediator between HTML views and models.

  Laravel 5.6 Server Side Validation Example

<script>
    var liveApp = angular.module('liveApp', []);
    liveApp.controller('liveCtrl',
        function ($scope, $window) {

            $scope.simpleSetFocus = function () {
                var dataparam = $window.document.getElementById('t');
                dataparam.focus();
            };
        });
	//simple directive in angular
    liveApp.directive("datepicker", function () {
        function link(scope, element, attrs, controller) {
		//scope datepicker
            element.datepicker({
                onSelect: function (dt) {
				//apply datepicker function
                    scope.$apply(function () {
                        controller.$setViewValue(dt);
                    });
                },
                dateFormat: "mm/dd/yy"
            });
        }
        return { require: 'ngModel', link: link };
    });
</script>
</html>

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is Automatically Set Focus on a Textbox (Input Box) in AngularJS And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

Leave a Reply

avatar
  Subscribe  
Notify of