Closed jurisbunkerex closed 4 years ago
Quite possible that the example code isn't adopted for higher Angular versions (higher than we have in package.json there).
So, can you create small repro for this issue?
🐞 bug report Affected Package Presumably assets/datafeeds
Description Example code doesn't work on higher Angular version
🔬 Minimal Reproduction
index.html:
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="/assets/datafeeds/udf/dist/polyfills.js"></script>
<script src="/assets/datafeeds/udf/dist/bundle.js"></script>
tsconfig.app.json:
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/app",
"types": []
},
"files": ["src/main.ts", "src/polyfills.ts"],
"include": ["src/**/*.d.ts"],
"exclude": ["assets/datafeeds/udf/src"]
}
component.ts:
import { Component, Input, OnInit, OnDestroy } from "@angular/core";
import {
widget,
IChartingLibraryWidget,
ChartingLibraryWidgetOptions,
LanguageCode
} from "../../../../assets/charting_library/charting_library.min";
@Component({ selector: "app-trading-view", templateUrl: "./trading-view.component.html", styleUrls: ["./trading-view.component.scss"] }) export class TradingViewComponent implements OnInit, OnDestroy {
...
datafeed: new (window as any).Datafeeds.UDFCompatibleDatafeed(this._datafeedUrl)
...
🔥 Exception or Error
`TypeError: Cannot read property 'UDFCompatibleDatafeed' of undefined`
🌍 Your Environment
"dependencies": { "@angular/animations": "^9.0.0-rc.8", "@angular/cdk": "^9.0.0-rc.8", "@angular/common": "~9.0.0-rc.8", "@angular/compiler": "~9.0.0-rc.8", "@angular/core": "~9.0.0-rc.8", "@angular/forms": "~9.0.0-rc.8", "@angular/material": "^9.0.0-rc.8", "@angular/platform-browser": "~9.0.0-rc.8", "@angular/platform-browser-dynamic": "~9.0.0-rc.8", "@angular/router": "~9.0.0-rc.8", "@auth0/auth0-spa-js": "^1.6.4", "@microsoft/signalr": "^3.1.3", "ag-grid-angular": "^22.1.1", "ag-grid-community": "^22.1.1", "hammerjs": "^2.0.8", "rxjs": "~6.5.3", "tslib": "^1.10.0", "zone.js": "~0.10.2" }, "devDependencies": { "@angular-devkit/build-angular": "~0.900.0-rc.8", "@angular-devkit/build-ng-packagr": "~0.900.0-rc.8", "@angular/cli": "~9.0.0-rc.8", "@angular/compiler-cli": "~9.0.0-rc.8", "@angular/language-service": "~9.0.0-rc.8", "@types/jquery": "^1.10.31", "@types/node": "^12.11.1", "ng-packagr": "^9.0.0-rc.5", "ts-node": "~8.3.0", "typescript": "~3.6.4" }
Anything else relevant?
Works fine in this env:
"dependencies": {
"@angular/animations": "~9.1.12",
"@angular/cdk": "^9.2.4",
"@angular/common": "~9.1.12",
"@angular/compiler": "~9.1.12",
"@angular/core": "~9.1.12",
"@angular/forms": "~9.1.12",
"@angular/material": "^9.2.4",
"@angular/platform-browser": "~9.1.12",
"@angular/platform-browser-dynamic": "~9.1.12",
"@angular/router": "~9.1.12",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.11",
"@angular/cli": "~9.1.11",
"@angular/compiler-cli": "~9.1.12",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~7.0.0",
"@types/jquery": "^1.10.31",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.8.3"
}
Needs an ng update
Hello,
I don't consider this duplicate with other issues, because previous solutions don't work.
I am trying to make tradingview to work with Angular 9, but I am getting TypeError:
Cannot read property 'UDFCompatibleDatafeed' of undefined
I have inserted script sources in index.html. Added
"exclude": ["assets/datafeeds/udf/src"]
to tsconfigTried a lot of things but this line doesn't work:
datafeed: new (window as any).Datafeeds.UDFCompatibleDatafeed(this._datafeedUrl),
My TypeScript version: "~3.6.4"
Any sugestions? Thank you