When should you use an attribute versus an element?



When should you use an attribute versus an element?..

Answer / Pankaj Bhardwaj

In AngularJS, elements are used to represent HTML tags and have a fixed structure, while attributes are additional properties that can be added to elements. You should use elements when you want to create an actual HTML tag (such as 'div' or 'input'), and you should use attributes to specify properties or behaviors of the element.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

On which types of component can we create a custom directive?

1 Answers  


Name the key features of angular js?

1 Answers  


Why to use “$http” in AngularJS?

1 Answers  


Is angular material open source?

1 Answers  


How AngularJS handle data binding?

1 Answers  


Mention some of the most commonly used directives in angularjs application?

1 Answers  


What is $location in angularjs?

1 Answers  


What are the binding directives in angularjs?

1 Answers  


What is traceur compiler? Why in angular 2?

1 Answers  


How you can load external css style?

1 Answers  


Explain two-way binding in angularjs?

1 Answers  


How do we display errors in a component view with angular 2?

1 Answers  


Categories