1 | const examples = [
|
2 | {
|
3 | name: 'Simple',
|
4 | template: 'Hello {{name}}!',
|
5 | scope: {
|
6 | name: 'Alex',
|
7 | },
|
8 | },
|
9 | {
|
10 | name: 'Spaces',
|
11 | template: '{{ person . name}} is {{ person ["age"] }} years old',
|
12 | scope: {
|
13 | person: {
|
14 | name: 'Dale',
|
15 | age: 17,
|
16 | },
|
17 | },
|
18 | },
|
19 | {
|
20 | name: 'Undefined and null',
|
21 | template: 'Try the "explicit" option. Null is "{{n}}" and undefined is "{{u}}"',
|
22 | scope: {
|
23 | n: null,
|
24 | },
|
25 | },
|
26 | {
|
27 | name: 'Array',
|
28 | template: 'I like {{0}}, {{4}} and {{[2]}} out of {{length}} fruits!',
|
29 | scope: ['Apple', 'Orange', 'Banana', 'Citrun', 'Tomato'],
|
30 | },
|
31 | {
|
32 | name: 'Nested',
|
33 | template: "{{person.name}}'s mobile nr is: {{person.contacts.tel[1].nr}}!",
|
34 | scope: {
|
35 | person: {
|
36 | name: 'Alex',
|
37 | contacts: {
|
38 | address: 'Stockholm, Sweden',
|
39 | tel: [
|
40 | {
|
41 | nr: '+4600000000',
|
42 | },
|
43 | {
|
44 | nr: '+4611111111',
|
45 | },
|
46 | ],
|
47 | },
|
48 | },
|
49 | },
|
50 | },
|
51 | ]
|