angular-threejs / angular-three

Angular Renderer for THREE.js
MIT License
193 stars 26 forks source link

ERROR TypeError: this.initRoot is not a function #46

Closed Nomackleo closed 1 week ago

Nomackleo commented 3 weeks ago

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: `

`, 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

elkestudio commented 3 weeks ago

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

Nomackleo commented 2 weeks ago

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

nartc commented 1 week ago

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