the library (#circlon/angular-tree-component) which declares TreeModel has not been processed correctly by ngcc, is not compatible with Angular Ivy - html

ERROR in node_modules/#circlon/angular-tree-component/lib/models/tree.model.d.ts:7:22 - error
i am trying to use #circlon/angular-tree-component for the menu in tree-view with checkboxes.
and throws error something like...
NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
This likely means that the library (#circlon/angular-tree-component) which declares TreeModel has not been processed correctly
by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
7 export declare class TreeModel implements ITreeModel, OnDestroy {
how to resolve this...?
thanx.

Related

Migration issue Angular 8 to 9

I'm updating my angular project to use angular 9. In angular 8 I was using ng5-bootstrap-modal, but now I'm getting error:
ERROR in node_modules/ng5-bootstrap-modal/dist/bootstrap-modal.module.d.ts:4:22
error NG6002: Appears in the NgModule.imports of SharedModule, but could not be resolved to an NgModule class.
This likely means that the library (ng5-bootstrap-modal) which
declares BootstrapModalModule has not been processed correctly by
ngcc, or is not compatible with Angular Ivy. Check if a newer version
of the library is available, and update if so. Also consider checking
with the library's authors to see if the library is expected to be
compatible with Ivy.
Did anyone face the same issue?

"Error encountered resolving symbol values statically" when importing JSON in Angular

I have an application in Angular 4 and I want to display version of my application somewhere in the view. The version string is expectedly contained in package.json version property.
What I've tried is to create a class and import JSON file directly into it, then expose the variable through getter method:
import * as PACKAGE from './../../../package.json';
export class PackageService {
public static getVersion (): string {
return (PACKAGE as any).version;
}
}
However, this solution raises compilation problems such as this one:
ERROR in Error encountered resolving symbol values statically. Expression form not supported (position 8:13 in the original .ts file), resolving symbol PackageService.getVersion in ./src/app/services/package.service.ts, resolving symbol AppModule in ./src/app/app.module.ts, resolving symbol AppModule in ./src/app/app.module.ts
webpack: Failed to compile.
Looks like the problem is with method being static. When I convert this class to normal Angular injectable service. It compiles correctly.
I'm using static method in order to add version string to DI container with: {provide: DI_VERSION, useValue: PackageService.getVersion()}, where DI_VERSION is an injection token. This would allow me to access the version string directly without injecting entire service and calling methods on it.
What exactly is causing this error and how do I fix it?

Unable to use HTML form validators for Angular AoT - "property 'required does not exist"

I'm attempting to build an Angular 2 project, using angular-cli with the --prod and --aot arguments. The build is failing with the following error:
Property 'required' does not exist on type '{ [key: string]: any; }'.
In my HTML, I'm using HTML validation on some of my inputs (required, pattern attributes).
Using JIT compilation, these work as expected. It is only during AoT compilation that the errors occur.
Has anyone seen this before? I was hoping not to have to resort to defining all of my forms using the ReactiveForms method and using the Angular Validators, unless there's no way around it.
The following are some things that will make AoT compile fail.
Don’t use require statements for your templates or styles, use styleUrls and templateUrls, the angular2-template-loader plugin will change it to require at build time.
Don’t use default exports.
Don’t use form.controls.controlName, use form.get(‘controlName’)
Don’t use control.errors?.someError, use control.hasError(‘someError’)
Don’t use functions in your providers, routes or declarations, export a function and then reference that function name
#Inputs, #Outputs, View or Content Child(ren), Hostbindings, and any field you use from the template or annotate for Angular should be public

Export objects and classes before their declaration makes them undefined

I try to repeat example from Mozilla Hacks (Export lists subtitle):
//export.js
export {detectCats, Kittydar};
function detectCats() {}
class Kittydar {}
//import.js
import {detectCats, Kittydar} from "./export.js";
console.log(detectCats); // function detectCats() {}
console.log(Kittydar); // undefined
Oops: Kittydar is undefined (btw., the problem is the same with simple Object).
But if I put export after Kittydar declaration it's ok:
//export.js
class Kittydar {}
export {Kittydar};
//import.js
import {Kittydar} from "./export.js";
console.log(Kittydar); // function Kittydar() {_classCallCheck(this, Kittydar);}
Is this a typo in the article?
I transpile this with babel and bundle with browserify. Then I include output bundle in a usual .html file (with <script> tag).
The standard is hard to follow on this, but the article is correct. This code works in es6draft and in the SpiderMonkey shell: both the function and the class are initialized by the time those console.log calls run.
Here's how it's supposed to work, in minute detail:
The JS engine parses import.js. It sees the import declaration, so then it loads export.js and parses it as well.
Before actually running any of the code, the system creates both module scopes and populates them with all the top-level bindings that are declared in each module. (The spec calls this ModuleDeclarationInstantiation.) A Kittydar binding is created in export.js, but it's uninitialized for now.
In import.js, a Kittydar import binding is created. It's an alias for the Kittydar binding in export.js.
export.js runs. The class is created. Kittydar is initialized.
import.js runs. Both console.log() calls work fine.
Babel's implementation of ES6 modules is nonstandard.
I think it's deliberate. Babel aims to compile ES6 modules into ES5 code that works with an existing module system of your choice: you can have it spit out AMD modules, UMD, CommonJS, etc. So if you ask for AMD output, your code might be ES6 modules, but the ES5 output is an AMD module and it's going to behave like an AMD module.
Babel could probably be more standard-compliant while still integrating nicely with the various module systems, but there are tradeoffs.

netbeans: API Versioning tab, public packages org.demo.textfilter not automatically imported

following the tutorial at
http://platform.netbeans.org/tutorials/nbm-quick-start.html#lookup
"Right-click the "TextFilter" module, choose Properties, and use the "API Versioning" tab so specify that the package containing the interface should be available throughout the application: " (org.demo.textfilter is set to public)
the problem is, this public package is not automatically imported by another class in another module with dependency on the TextFilter module. Whenever the dependencies are added, shouldn't the dependent classes/modules automatically import the dependencies ?
Your question is a bit hard to interpret, so I will tell you what I think you are asking and then provide an answer....
I assume that you have a couple netbeans module projects: TextFilter and MyModule.
Initially, MyModule depends on TextFilter.
There is a third module, let's call it Filter... that has a public, exported class org.filter.BaseClass.
You have made TextFilter dependent on Filter, so you can use the org.filter.BaseClass in the TextFilter module.
You are now attempting to use org.filter.BaseClass in MyModule and that is not working.
Module dependency defines the visibility of classes. That visibility does not span modules.
If you want MyModule to be able to use org.filter.BaseClass, you need to explicitly define the dependency between the module Filter and MyModule.