javascript - Is there any difference between `element` and `iElement` in AngularJS? -


i using angularjs , jquery, angularjs official tutorial using ielement inject, other tutorial using element, there different? following btn1 , btn2 work, element , ielement wrap jquery.

var app = angular.module('myapp', []);  app.directive('btn1', function () {     return function (scope, element) {         element.click(function () {             $(this).css('background', '#666');         });     }; });  app.directive('btn2', function () {     return function (scope, ielement) {         ielement.click(function () {             $(this).css('background', '#666');         });     }; }); 

no, there no difference, both 2 variable names. can use name instead of element/ielement el/eleme etc, factor matters in values passed callback in case link callback function passes scope, element, attributes , controllers.

when matters when use environment argument injection used in controller function or in directive function parameter names used injecting parameters


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -