我需要获取页面标题并将其写入变量。我正在使用打字稿代码:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'home',
templateUrl: './home.component.html'
})
export class HomeComponent implements OnInit {
title: string;
ngOnInit() {
console.log("Title is " + this.title);
this.title === document.title;
}
}
Run Code Online (Sandbox Code Playgroud)
但我在控制台上收到“标题未定义”。
我也尝试过:
title: string;
ngOnInit() {
this.title === this.titleService.getTitle();
console.log("Title is " + this.title);
}
public constructor(private titleService: Title) { }
getTitle() {
this.titleService.getTitle();
}
Run Code Online (Sandbox Code Playgroud)
但结果是一样的。获取页面标题的正确方法是什么?
我的AutoIt脚本启动另一个脚本(用UIAutomation编写).所以我写了这个:
RunWait("C:\AutoUIInst\Test\bin\Debug\" & "Test.exe", "","")
Run Code Online (Sandbox Code Playgroud)
它工作正常.但现在我必须添加一个参数.例如:"Test.exe -someParam".所以我试过RunWait():
RunWait('"C:\AutoUIInst\Test\bin\Debug\" & "Test.exe" -someParam', "","")
Run Code Online (Sandbox Code Playgroud)
那不行.有人可以帮忙吗?