Closed Cateye82 closed 5 years ago
Hi @Cateye82, I tested the described problem in a sample project, however, was unable to recreate the issue. For your convenience, I am attaching my sample project. Please review it and make the needed changes, that will allow us to reproduce the problem. Archive.zip
Hi @tsonevn, thank you for your reply, I will take a look to your code as soon as possible. Right now I just proofed that your code compiles fine. Hopefully I will find the difference compared to mine to post the solution here.
HI @tsonevn, I made the changes to the source code to reproduce the issue. Basically I separated the ActionBar into the "topbar" component and loaded it by the "shared" module. Archive.zip
Hi @Cateye82,
Thank you for the additional info and the new sample project.
I was able to recreate the problem, however, after adding the NO_ERRORS_SCHEMA
in the shared.module.ts
file, the issue is no longer reproducible. For example:
import {NgModule, NO_ERRORS_SCHEMA} from '@angular/core';
import {NativeScriptCommonModule} from "nativescript-angular/common";
import {NativeScriptFormsModule} from 'nativescript-angular/forms';
import {NativeScriptHttpModule} from 'nativescript-angular/http';
import {NativeScriptHttpClientModule} from "nativescript-angular/http-client";
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
import {TopbarComponent} from "../topbar/topbar.component";
@NgModule({
imports: [
NativeScriptCommonModule,
NativeScriptFormsModule,
NativeScriptHttpModule,
NativeScriptHttpClientModule,
FormsModule,
ReactiveFormsModule
],
declarations: [
TopbarComponent
],
exports: [
NativeScriptCommonModule,
NativeScriptFormsModule,
NativeScriptHttpModule,
NativeScriptHttpClientModule,
FormsModule,
ReactiveFormsModule,
TopbarComponent
],
schemas: [
NO_ERRORS_SCHEMA
]
})
export class SharedModule {
}
Can you try adding the NO_ERRORS_SCHEMA
in your project into the shared module and check if you will be able to recreate the problem.
For your convenience, I am attaching the project with the needed change.
Archive.zip
Hi @tsonevn, you are right, this solved my issue. It didn't came to my mind that the missing schema is causing such an error. Thank you for your support.
Environment Provide version numbers for the following components (information can be retrieved by running
tns info
in your project folder or by inspecting thepackage.json
of the project):Describe the bug I am using an custom ActionBar like followed:
After that i call:
tns run android --bundle --env.uglify --env.aot --env.snapshot
Which will result in:
So I removed --env.aot and works. It seems that the AOT Option is causing this issue.
To Reproduce Take the ActionBar code (loaded in a shared module) and try to run it with:
Expected behavior Should compile for the USB connected device.
Sample project I don't have this project public but can invite on GitHub.
Additional context Haven't found something so far.