first commit
This commit is contained in:
20
test.ts
Normal file
20
test.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Inject, Injectable } from "bmydi";
|
||||
|
||||
@Injectable()
|
||||
class Demo1 {
|
||||
public hello: string = "我是Demo1类"
|
||||
}
|
||||
|
||||
class Demo2 {
|
||||
|
||||
@Inject()
|
||||
public test!: Demo1;
|
||||
|
||||
public GetTest(): string {
|
||||
return this.test.hello // 返回:"我是Demo1类"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var a = new Demo2();
|
||||
console.log(a.GetTest());
|
||||
Reference in New Issue
Block a user