Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS: Difference between Template and View?

Tags:

angularjs

I know it might be an easy question, but I didn't find an answer :-/

I read in SPA many times the word 'Templates' into which the data is loaded. Are 'Templates' just a regular View into which the data is filled into? Or what is the difference and do they overlap?

like image 772
LeO Avatar asked Aug 20 '15 13:08

LeO


People also ask

What is template and view in Angular?

A template is a form of HTML that tells Angular how to render the component. Views are typically organized hierarchically, allowing you to modify or show and hide entire UI sections or pages as a unit. The template immediately associated with a component defines that component's host view.

What is the difference between template and template URL in Angular?

According to Angular, when you have a complex view (i.e. a view with more than 3 lines), then go with templateUrl (use external file); otherwise, use the template (inline HTML) properly of the component decorator.

Is AngularJS a template engine?

AngularJS is client-side template rendering while Express is server-side. Though, there is some potential for overlap (there are variants of EJS for both environments).

What are the different templates in Angular?

There are two types of templates: Static Template. Dynamic Templates.


1 Answers

  • A template in angularJs is a HTML with additional markup in it, You can read more about it here: https://docs.angularjs.org/guide/concepts#template, https://docs.angularjs.org/guide/
  • A view is according to angularJs documentation is the parsed and processed template (the DOM)

When AngularJS starts your application, it parses and processes this new markup from the template using the compiler. The loaded, transformed and rendered DOM is then called the view.

ref: https://docs.angularjs.org/guide/concepts#view

like image 75
digitamo Avatar answered Sep 29 '22 17:09

digitamo