December 2017
Beginner
372 pages
10h 32m
English
The string data type represents textual data in UTF-16 format. To assign a string value to a variable, we use single (') or double (") quotes. We can also create a string that spans multiple lines, and is called a template string. The following is an example of declaring strings:
let firstName: string = 'John';let templateHTML: string = `<h1>Title</h1>`
In the preceding code, templateHTML is an example of using a template string. This is one of the features that is very frequently used in Angular to define inline templates for its components. We will see these when we start working on our application.
The strings also have an ability to add dynamic expression in its definition, as shown in the following example. The result variable ...
Read now
Unlock full access