我正在开发一个大型项目,该项目已经开发了好几年,并且拥有大量的代码.最近无法提醒的警报开始出现.它只是说Undefined.我需要找到此警报的来源.是否有机会制作"断点警报"之类的东西?我想看看这个警报的来源.一种可能性是重新定义警报功能.我试图在Firefox中制作它没有任何成功.
我有一个组件向我的服务请求一个 Observable 对象(也就是说,底层的 http.get 返回一个对象)。
该对象(可观察的)与我的模板中的异步管道结合使用。不幸的是,我收到一个错误:
无法读取 null 的属性“姓氏”
我一直在为这件事伤透脑筋。类似类型的代码可以在对象列表上正确运行(与 *ngFor 结合使用)。
<li>{{(person | async)?.lastname}}</li>
Run Code Online (Sandbox Code Playgroud)
我的服务中的方法:
getPerson(id: string): Observable<Person> {
let url = this.personsUrl + "/" + id;
return this.http.get(url, {headers: new Headers({'Accept':'application/json'})})
.map(r => r.json())
.catch(this.handleError); //error handler
}
Run Code Online (Sandbox Code Playgroud)
在我的组件中:
//... imports omitted
@Component({
moduleId: module.id,
selector: 'app-details-person',
templateUrl: 'details-person.component.html',
styleUrls: ['details-person.component.css'],
})
export class DetailsPersonComponent implements OnInit, OnDestroy
{
person: Observable<Person>;
sub: Subscription;
constructor(private personService: PersonService, private route: ActivatedRoute) {
}
ngOnInit() {
this.sub = this.route.params.subscribe(params => { …Run Code Online (Sandbox Code Playgroud) 我正在使用 Angular 12,在我的 component.html 中,我需要有一个 3 级条件。
例如:
我有一个列表,我需要检查它是否包含字符串。
true 和 false 状态都有不同的输出,最后我需要针对任何其他条件进行 ELSE。
所以......首先我有一个条件:
<div *ngIf="list.includes('sometext') && listitem === null ">Condition 1</div>
Run Code Online (Sandbox Code Playgroud)
现在的条件与上述相反:
<div *ngIf="!list.includes('sometext') && listitem === null ">Condition 2</div>
Run Code Online (Sandbox Code Playgroud)
最后是ELSE:
<div>Condition 3 or Any other condition from the others above</div>
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
当测试 a 的 DOM 表示时@Component,您可以通过其固定装置查询其嵌套元素
fixture.debugElement.queryAll(By.css('.example'));
Run Code Online (Sandbox Code Playgroud)
您还可以按以下条件过滤@Directive
fixture.debugElement.queryAll(By.directive(RouterLinkDirectiveStub));
Run Code Online (Sandbox Code Playgroud)
现在,假设你有一个@Component NzButtonComponent像这样使用的内部
<button nz-button>Example</button>
Run Code Online (Sandbox Code Playgroud)
怎样才能精确查询到呢?没有By.component(...)。
我用反编译工具发现了这个结构.看起来它与多线程有关.^(int&)在c#中意味着什么?
UPD
它使用了变量声明
^(int&) @someLock