Posts

Showing posts from June, 2017

Angular Validation

AngularJS Form Validation AngularJS tin validate input data. Form Validation AngularJS offers client-side shape validation. AngularJS monitors the the world of the shape in addition to input fields (input, textarea, select), in addition to lets yous notify the user well-nigh the electrical flow state. AngularJS besides holds information well-nigh whether they guide keep been touched, or modified, or not. You tin exercise criterion HTML5 attributes to validate input, or yous tin brand your ain validation functions. Client-side validation cannot lone secure user input. Server side validation is besides necessary. Required Use the HTML5 attribute required to specify that the input land must live filled out: Example The input land is required: < form name ="myForm" > < input name ="myInput" ng-model ="myInput" required > < /form > < p > The input's valid the world is: < /p

Angular Events

AngularJS Events AngularJS has its ain HTML events directives. AngularJS Events You tin add together AngularJS final result listeners to your HTML elements yesteryear using ane or to a greater extent than of these directives: ng-blur ng-change ng-click ng-copy ng-cut ng-dblclick ng-focus ng-keydown ng-keypress ng-keyup ng-mousedown ng-mouseenter ng-mouseleave ng-mousemove ng-mouseover ng-mouseup ng-paste The final result directives allows us to run AngularJS functions at for certain user events. An AngularJS final result volition non overwrite an HTML event, both events volition survive executed. Mouse Events Mouse events come about when the cursor moves over an element, inwards this order: ng-mouseenter ng-mouseover ng-mousemove ng-mouseleave Or when a mouse push is clicked on an element, inwards this order: ng-mousedown ng-mouseup ng-click You tin add together mouse events on whatsoever HTML element. Example Increase the

Angular Sql

AngularJS SQL AngularJS is perfect for displaying information from a Database. Just brand certain the information is inwards JSON format. Fetching Data From a PHP Server Running MySQL AngularJS Example < div ng-app ="myApp" ng-controller ="customersCtrl" > < table >   < tr ng-repeat ="x inwards names" >     < td > {{ x.Name }} < /td >     < td > {{ x.Country }} < /td >   < /tr > < /table > < /div > < script > var app = angular. module ( 'myApp' , []); app. controller ( 'customersCtrl' , function ($scope, $http) {     $http. get ( "customers_mysql.php" )     . then ( function (response) {$scope. names = response. data . records ;}); }); < /script > Fetching Data From an ASP.NET Server Running SQL AngularJS Example < div ng-app ="myApp" ng-controller ="customersCtrl" > <

Angula Select

AngularJS Select Boxes AngularJS lets you lot practise dropdown lists based on items inward an array, or an object. Creating a Select Box Using ng-options If you lot desire to practise a dropdown list, based on an object or an array inward AngularJS, you lot should exercise the ng-options directive: Example < div ng-app ="myApp" ng-controller ="myCtrl" > < select ng-model ="selectedName" ng-options ="x for x inward names" > < /select > < /div > < script > var app = angular. module ( 'myApp' , []); app. controller ( 'myCtrl' , function ($scope) {     $scope. names = [ "Emil" , "Tobias" , "Linus" ]; }); < /script > ng-options vs ng-repeat You tin too exercise the ng-repeat directive to construct the same dropdown list: Example < select > < option ng-repeat ="x inwa

Angular Services

AngularJS Services In AngularJS y'all tin brand your ain service, or utilization i of the many built-in services. What is a Service? In AngularJS, a service is a function, or object, that is available for, in addition to express to, your AngularJS application. AngularJS has virtually thirty built-in services. One of them is the $location service. The $location service has methods which furnish information virtually the place of the electrical current spider web page: Example Use the $location service inwards a controller: var app = angular. module ( 'myApp' , []); app. controller ( 'customersCtrl' , function ($scope, $location) {     $scope. myUrl = $location. absUrl (); }); Note that the $location service is passed inwards to the controller equally an argument. In guild to utilization the service inwards the controller, it must last defined equally a dependency. Why utilization Services? For many services

Angular Filters

AngularJS Filters Filters tin order the axe live added inward AngularJS to format data. AngularJS Filters AngularJS provides filters to transform data: currency Format a let on to a currency format. date Format a appointment to a specified format. filter Select a subset of items from an array. json Format an object to a JSON string. limitTo Limits an array/string, into a specified let on of elements/characters. lowercase Format a string to lower case. number Format a let on to a string. orderBy Orders an array past times an expression. uppercase Format a string to upper case. Adding Filters to Expressions Filters tin order the axe live added to expressions past times using the piping grapheme | , followed past times a filter. The uppercase filter format strings to upper case: Example < div ng-app ="myApp" ng-controller ="personCtrl" > < p > The cite is {{ lastName | working capital alphabetic lineament