Angular 什么';这句话有什么好处;

Angular 什么';这句话有什么好处;,angular,typescript,angular7,Angular,Typescript,Angular7,我在某个Angular 7类中发现了以下代码,对此感到困惑。。。这不是一个谷歌友好的声明来搜索。。。道歉:) @组件({ 选择器:'app some', templateUrl:“./some.component.html”, 样式URL:['./some.component.scss'], 供应商:[ 某些成分 ] }) 导出类另一个组件实现OnInit,OnChanges{ _=\u;//我猜它没有多大用处,但在角度设置中,您可能可以执行以下操作 @Component({ selecto

我在某个Angular 7类中发现了以下代码,对此感到困惑。。。这不是一个谷歌友好的声明来搜索。。。道歉:)

@组件({
选择器:'app some',
templateUrl:“./some.component.html”,
样式URL:['./some.component.scss'],
供应商:[
某些成分
]
})
导出类另一个组件实现OnInit,OnChanges{

_=\u;//我猜它没有多大用处,但在角度设置中,您可能可以执行以下操作

@Component({
  selector: 'app-some',
  templateUrl: './some.component.html',
  styleUrls: ['./some.component.scss'],
  providers: [
    SomeComponent
  ]
})
export class AnotherComponent implements OnInit, OnChanges {

constructor(public _: dataService){}

  _ = _;
}

这只是将
\uucode>的组件变量重新分配给dataService(同样,它已经被分配了)。我想我想不出一个好的用例。

我猜它没有多大用处,但你可能可以在角度设置中执行以下操作

@Component({
  selector: 'app-some',
  templateUrl: './some.component.html',
  styleUrls: ['./some.component.scss'],
  providers: [
    SomeComponent
  ]
})
export class AnotherComponent implements OnInit, OnChanges {

constructor(public _: dataService){}

  _ = _;
}

这只会将
\uu
的组件变量重新分配给数据服务(同样,它已经被分配)。我想不出一个好的用例。

如果
\u
在另一个文件中全局声明:

export var _ = "Hello world!";
您可能希望将其指定给组件类的属性,以使其在模板中可用:

import { _ } from "./external.model";

export class AppComponent {
  _ = _;
}
{{{}

有关演示,请参阅。

如果在另一个文件中全局声明了

export var _ = "Hello world!";
您可能希望将其指定给组件类的属性,以使其在模板中可用:

import { _ } from "./external.model";

export class AppComponent {
  _ = _;
}
{{{}

请参阅演示。

第一个
是一个字段的声明
=
之后的
是一个变量,已经在作用域中:
npm uninstall lodash underline
应该可以解决问题。@reactular yes确实我在这个项目中依赖于lodash:d第一个
是一个字段的声明
=
之后,作用域中已经有一个变量:
npm uninstall lodash下划线
应该可以解决问题。@reactular是的,确实我在这个项目中依赖lodash:DIf I comment it,那么应用程序就不再工作了(它无法呈现组件),所以必须给出一些东西:DIf I comment it,那么应用程序就不再工作了(它无法渲染组件)因此必须给出:D