calling variables from typescript file in html template [angular]

user2243952

I just started working with angular after reading the docs. I'm still a newbie.

Calling arrays in angular2 is simple:

you just have to use *ngfor item of items and then {{item.name}}.

what if I'm calling a single object, string or any, from my ts file . How can I do that?

I tried :

{{myvariable}} 

or

<div  ng-init="let x = myvariable">   {{x.name}}</div> 

and other stuff but it doesn't work. Thanks in advance.

Günter Zöchbauer
{{myvariable.id}} {{myvariable.name}}

or if the variable is not initialized yet when the component is created.

{{myvariable?.id}} {{myvariable?.name}}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Calling Typescript function from html2canvas in angular 2

From

Angular2 access global variables from HTML template

From Dev

Calling variables from file in functions

From Dev

TypeScript Angular Intellisense in html template

From Dev

angular2(typescript) export variables from another file

From Dev

How to display a variable from a typescript file to a html file using Angular?

From Javascript

How to debug objects from Angular template (html file)

From Dev

Multiple times method calling from angular template

From Dev

Calling a template function from a C file

From Dev

Problem with calling javascript from angular typescript

From Dev

Python: Calling queries from a file with variables

From Dev

Calling function from HTML to typescript not waited to finish

From Dev

Initialize TypeScript class inside Angular HTML template

From Dev

AngularJS directive: Reference local variables from external HTML file used in template

From Dev

Angular 5: calling method from html

From Dev

Calling an angular component method from classic HTML

From Dev

Calling Routes from a js angular 1.5.8 file

From Dev

Issue with calling a javascript file from a HTML page

From Dev

Calling a function from HTML to Python file

From Dev

Calling .js file from HTML using AJAX

From Javascript

Using html file as template for component in angular 2

From Dev

Calling the Angular router in TypeScript

From

Calling method from a Angular 2 class inside template

From Dev

Calling a TypeScript function in HTML?

From Dev

debugging typescript when calling an web api from angular

From Dev

Angular Modal: add template from another html

From Dev

Angular directive: template from other file

From Dev

calling python file from php an passing variables to python

From Dev

Calling typescript function from HTML using a module system

Related Related

  1. 1

    Calling Typescript function from html2canvas in angular 2

  2. 2

    Angular2 access global variables from HTML template

  3. 3

    Calling variables from file in functions

  4. 4

    TypeScript Angular Intellisense in html template

  5. 5

    angular2(typescript) export variables from another file

  6. 6

    How to display a variable from a typescript file to a html file using Angular?

  7. 7

    How to debug objects from Angular template (html file)

  8. 8

    Multiple times method calling from angular template

  9. 9

    Calling a template function from a C file

  10. 10

    Problem with calling javascript from angular typescript

  11. 11

    Python: Calling queries from a file with variables

  12. 12

    Calling function from HTML to typescript not waited to finish

  13. 13

    Initialize TypeScript class inside Angular HTML template

  14. 14

    AngularJS directive: Reference local variables from external HTML file used in template

  15. 15

    Angular 5: calling method from html

  16. 16

    Calling an angular component method from classic HTML

  17. 17

    Calling Routes from a js angular 1.5.8 file

  18. 18

    Issue with calling a javascript file from a HTML page

  19. 19

    Calling a function from HTML to Python file

  20. 20

    Calling .js file from HTML using AJAX

  21. 21

    Using html file as template for component in angular 2

  22. 22

    Calling the Angular router in TypeScript

  23. 23

    Calling method from a Angular 2 class inside template

  24. 24

    Calling a TypeScript function in HTML?

  25. 25

    debugging typescript when calling an web api from angular

  26. 26

    Angular Modal: add template from another html

  27. 27

    Angular directive: template from other file

  28. 28

    calling python file from php an passing variables to python

  29. 29

    Calling typescript function from HTML using a module system

HotTag

Archive