angular-threejs/angular-three

ERROR TypeError: this.initRoot is not a function

Closed this issue · 3 comments

I have a problem during the setup of Angular Three.

"dependencies": { "@angular/animations": "^18.1.0", "@angular/common": "^18.1.0", "@angular/compiler": "^18.1.0", "@angular/core": "^18.1.0", "@angular/forms": "^18.1.0", "@angular/platform-browser": "^18.1.0", "@angular/platform-browser-dynamic": "^18.1.0", "@angular/platform-server": "^18.1.0", "@angular/router": "^18.1.0", "@angular/ssr": "^18.1.3", "angular-three": "^2.0.0-beta.42", "express": "^4.18.2", "ngxtension": "^0.3.0", "rxjs": "~7.8.0", "three": "^0.155.0", "tslib": "^2.3.0", "zone.js": "~0.14.3" }, "devDependencies": { "@angular-devkit/build-angular": "^18.1.3", "@angular/cli": "^18.1.3", "@angular/compiler-cli": "^18.1.0", "@types/express": "^4.17.17", "@types/jasmine": "~5.1.0", "@types/node": "^18.18.0", "@types/three": "^0.155.0", "jasmine-core": "~5.1.0", "karma": "~6.4.0", "karma-chrome-launcher": "~3.2.0", "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", "typescript": "~5.5.2" }

components:
`import {
ChangeDetectionStrategy,
Component,
CUSTOM_ELEMENTS_SCHEMA,
} from '@angular/core';
import { extend, NgtCanvas } from 'angular-three';
import { BoxGeometry, Mesh } from 'three';

extend({
Mesh,
BoxGeometry,
});

@component({
standalone: true,
template: <ngt-mesh> <ngt-box-geometry /> </ngt-mesh>,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SceneGraph {}

@component({
selector: 'app-second-scene',
standalone: true,
imports: [NgtCanvas],
templateUrl: <ngt-canvas [sceneGraph]="sceneGraph"></ngt-canvas>,
styleUrl: './second-scene.component.css',
})
export class SecondSceneComponent {
readonly sceneGraph = SceneGraph;
}`

ERROR:
image

Hi @Nomackleo for angular version 18.1.0 I'm using:

"angular-three": "^2.0.0-beta.257" and "three": "^0.166.1"

Keep in mind that library is still in beta

Hi @elkestudio, thank you for the help. I'll to try with those versions.

v2 has been released officially. Please check out the documentation for latest info: https://angularthree.org