ahmed_sa Ответов: 0

При выполнении углового с основного проекта ASP.NET веб-API получаю ошибку


I have application work in asp.net core 2.1 visual studio 2017 work with angular

but when run page it show empty page

i make inspect inside web page i get error as below

Uncaught Error: inject() must be called from an injection context
at injectInjectorOnly (core.js:1188)
at inject (core.js:1199)
at finished.component.ts:13
at Module../src/app/finished.component.ts (finished.component.ts:15)
at __webpack_require__ (bootstrap:78)
at Module../src/app/playQuiz.component.ts (main.js:592)
at __webpack_require__ (bootstrap:78)
at Module../src/app/app.module.ts (app.component.ts:8)
at __webpack_require__ (bootstrap:78)
at Module../src/main.ts (main.ts:1)

why thiserrordisplayand how to solve it
angular not have any compile error error display at run time

What I have tried:

<pre>import { Component , inject} from '@angular/core'
import { MAT_DIALOG_DATA } from '@angular/material'

@Component({


    
  template: `<h1>your score</h1>
  <h2>{{data.correct}}/{{data.total}}</h2>`

})
export class finishedComponent {
    constructor(@inject(MAT_DIALOG_DATA) private data){}
  
}

0 Ответов