Index.cshtml
<my-angular-app appID="@Model.AppId">Loading...</my-angular-app>
util.ts
//function to get the attribute value.
export function getAttribute(app: string, attributeName: string) {
return document.getElementsByTagName(app)[0].getAttribute(attributeName);
}
app.component.ts
import { getAttribute } from './util'
export class AppComponent implements OnInit {
ngOnInit(){
let appId = getAttribute("my-angular-app", "appID")
}
}