@@ -226,7 +226,7 @@ import { Mesh } from 'three';
226226})
227227export class SceneGraph {
228228
229- meshRef = viewChild.required<ElementRef<Mesh>('mesh');
229+ meshRef = viewChild.required<ElementRef<Mesh>> ('mesh');
230230
231231 constructor() {
232232
@@ -250,7 +250,7 @@ Using Angular means we can make components out of our template. Let's do that fo
250250<Tabs >
251251 <TabItem label = " src/app/cube.component.ts" >
252252 ``` angular-ts
253- import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, ViewChild } from '@angular/core';
253+ import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, viewChild } from '@angular/core';
254254 import { injectBeforeRender } from 'angular-three';
255255 import { Mesh } from 'three';
256256
@@ -261,7 +261,8 @@ Using Angular means we can make components out of our template. Let's do that fo
261261 <ngt-mesh #mesh>
262262 <ngt-box-geometry />
263263 </ngt-mesh>
264- `
264+ `,
265+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
265266 })
266267 export class Cube {
267268 meshRef = viewChild.required<ElementRef<Mesh>>('mesh');
@@ -310,8 +311,8 @@ We will add 2 states `hovered` and `clicked` to the cube component:
310311- When the cube is clicked, we'll change its scale
311312
312313``` diff lang="angular-ts" title="src/app/cube.component.ts"
313- - import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, ViewChild } from '@angular/core';
314- + import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, ViewChild , signal } from '@angular/core';
314+ - import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, viewChild } from '@angular/core';
315+ + import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, viewChild , signal } from '@angular/core';
315316import { injectBeforeRender } from 'angular-three';
316317import { Mesh } from 'three';
317318
@@ -330,6 +331,7 @@ import { Mesh } from 'three';
330331+ <ngt-mesh-basic-material [color]="hovered() ? 'darkred' : 'mediumpurple'" />
331332 </ngt-mesh>
332333 `,
334+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
333335})
334336export class Cube {
335337 meshRef = viewChild.required<ElementRef<Mesh>>('mesh');
@@ -361,8 +363,8 @@ However, we need to render the cube in different positions so we can see them bo
361363Let's do that by adding a ` position ` input to the Cube component
362364
363365``` diff lang="angular-ts" title="src/app/cube.component.ts"
364- - import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, ViewChild , signal } from '@angular/core';
365- + import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, ViewChild , signal, input } from '@angular/core';
366+ - import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, viewChild , signal } from '@angular/core';
367+ + import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, viewChild , signal, input } from '@angular/core';
366368
367369- import { injectBeforeRender } from 'angular-three';
368370+ import { injectBeforeRender, NgtVector3 } from 'angular-three';
@@ -384,6 +386,7 @@ import { Mesh } from 'three';
384386 <ngt-mesh-basic-material [color]="hovered() ? 'darkred' : 'mediumpurple'" />
385387 </ngt-mesh>
386388 `,
389+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
387390})
388391export class Cube {
389392+ position = input<NgtVector3>([0, 0, 0]);
@@ -420,7 +423,7 @@ import { Cube } from './cube.component';
420423+ <app-cube [position]="[1.5, 0, 0]" />
421424+ <app-cube [position]="[-1.5, 0, 0]" />
422425 `,
423- imports: [Cube]
426+ imports: [Cube],
424427 schemas: [CUSTOM_ELEMENTS_SCHEMA],
425428 changeDetection: ChangeDetectionStrategy.OnPush,
426429})
@@ -463,7 +466,7 @@ export class SceneGraph {
463466Next, we will want to change the ` Material ` of the cube to ` MeshStandardMaterial ` so that it can be lit by the lights.
464467
465468``` diff lang="angular-ts" title="src/app/cube.component.ts"
466- import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, ViewChild , signal, input } from '@angular/core';
469+ import { Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, viewChild , signal, input } from '@angular/core';
467470import { injectBeforeRender, NgtVector3 } from 'angular-three';
468471import { Mesh } from 'three';
469472
@@ -484,6 +487,7 @@ import { Mesh } from 'three';
484487+ <ngt-mesh-standard-material [color]="hovered() ? 'darkred' : 'mediumpurple'" />
485488 </ngt-mesh>
486489 `,
490+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
487491})
488492export class Cube {
489493 position = input<NgtVector3>([0, 0, 0]);
0 commit comments