1.

Explain The Components Of Aurelia?

Answer»

COMPONENTS are MAIN building blocks of Aurelia framework.

Simple Component : 

Each component contains view-model which is written in JavaScript and view, written in HTML. You can see our view-model definition below. This is an ES6 example but you can ALSO use TypeScript.

app.js

export class MyComponent
{
HEADER = "This is Header";
content = "This is content";
}

We can bind our values to the view as shown in example below. ${header} syntax will bind the defined header value from MyComponent. The same concept is applied for content.

app.html

${header}

${content}

Components are main building blocks of Aurelia framework.

Simple Component : 

Each component contains view-model which is written in JavaScript and view, written in HTML. You can see our view-model definition below. This is an ES6 example but you can also use TypeScript.

app.js

export class MyComponent
{
header = "This is Header";
content = "This is content";
}

We can bind our values to the view as shown in example below. ${header} syntax will bind the defined header value from MyComponent. The same concept is applied for content.

app.html

${header}

${content}



Discussion

No Comment Found