I am new to Angular and our team is developing a new web app with Angular as the base technology. I am having trouble just including a js class into the project. I have a js class Script.js which instantiates classes as below :
Script.prototype.createText = function () {
let text = new mText(this.mEngine);
this.addIntoAssetList(text);
text.addParent(this.rootElement);
//this.rootElement.addChild(text);
return text;
};
The mText.js file is in the same directory as the Script.js file
I am now trying to add a date class object in the Script.js file as below :
Script.prototype.createDate = function () {
let date = new mDate(this.maEngine);
console.log("date added");
this.addIntoAssetList(date);
this.addParent(this.rootElement);
return date;
};
the mDate.js is also in the same directory and is modeled like the mText.js file.
This much code isn't sufficient and the browser dev tools tell me that the mDate object doesnt exist.
I see there is an angular.json file which has list of all the scripts in the project, where the mText.js and other .js files are listed. I added the mDate.js file into this document, but once I do that, upon running the application, I get an error on the first line of the ngAfterViewInit from one of the .ts files which initiates the views :
ngAfterViewInit() {
window.ContentEditor.init();
window.ContentSave.init();
window.DataTable.init();
window.ExpressionEditor.init();
}
TypeError occured due to Cannot read property 'init' of undefined in the function ContentCreatorComponent
I'm not sure what needs to be done for something as simple as this. Pretty sure its a silly explanation!