我想更改html
元素的文本.
profile.component.html
<div class="col col-sm-12">
<h2>FirstName LastName</h2>
</div>
Run Code Online (Sandbox Code Playgroud)
profile.component.ts
changeName():void{
//Code to change the <h2> element
}
Run Code Online (Sandbox Code Playgroud)
如果你能提供代码示例如何做到这一点,那就太好了!
我可以得到<button pButton type="button" class="ui-button-danger"></button>
,但它不会风格化。我已在我的index.html 中链接了primeng.min.css。但我假设我的.angular-cli.json
文件有错误,因为样式部分是空的。
编辑:控制台错误说:无法加载资源:服务器响应状态为 404(未找到),但<link rel="stylesheet" type="text/css" href="/node_modules/primeng/resources/primeng.min.css" />
我已经仔细检查过,它就在那里。
有没有办法将 event.timestamp 转换为常规指标。我当前的输出是 267185117663619(纳秒??)。有没有办法将其转换为毫秒甚至秒?
timestamp = String.valueOf(event.timestamp);
Run Code Online (Sandbox Code Playgroud)
提前致谢!
我想在按下 list-profile html doc 中提供的链接后发送一个变量。当前代码不起作用并且崩溃了。如果需要,我可以提供更多细节。
列表-profile.component.html
<div class="col col-sm-4 col-sm-offset-4">
<ul id="list_of_users">
<li class="list-group-item list-group-item-action" *ngFor="let user of users"><a [routerLink]="['/profile', user.id]" routerLinkActive="active" (click)="testFunc(user.id)">{{user.name}}</a></li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
app.module.ts
const appRoutes: Routes = [
{ path: 'addProfile', component: AddProfileComponent },
{ path: 'listProfiles', component: ListProfilesComponent},
{ path: 'profile:id', component: ProfileComponent}
];
Run Code Online (Sandbox Code Playgroud) 我正在尝试发出一个我修改过的道具。我可以直接使用 prop 来做到这一点,它可以工作,但我收到一个 Vue 警告:Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders
因此,我尝试将 prop 放入计算中,但在执行计算之前执行发射。
template:
<input
v-on:keyup="validatedate(localDate)"
v-on:change="emitAnswer(localDate)"
v-model="localDate">
,
computed: {
dateLocal: {
get: function () {
return this.date
}
}
methods: {
emitAnswer: function (date) {
this.$emit('myFunc', date);
}
}
Run Code Online (Sandbox Code Playgroud) angular ×3
html ×3
android ×1
components ×1
css ×1
data-binding ×1
java ×1
javascript ×1
parameters ×1
primeng ×1
routing ×1
time ×1
timestamp ×1
typescript ×1
vue.js ×1