我得到的例子:1天前.我需要的是设置不同的语言,例如de.有什么建议怎么办?
moment(Date.now()).fromNow()
Run Code Online (Sandbox Code Playgroud)
我试过这个:
<script>
var moment = moment();
moment.locale('de');
</script>
Run Code Online (Sandbox Code Playgroud)
但得到一个错误:
时刻不是一个功能
我有这个表格:
<form id="login-form" class="text-left" (ngSubmit)="submitLogin()">
<div class="login-form-main-message"></div>
<div class="main-login-form">
<div class="login-group">
<div class="form-group">
<label for="lg_username" class="sr-only">Username</label>
<input type="text" class="form-control" id="lg_username" name="lg_username" placeholder="username" [(ngModel)]="username">
</div>
<div class="form-group">
<label for="lg_password" class="sr-only">Password</label>
<input type="password" class="form-control" id="lg_password" name="lg_password" placeholder="password" [(ngModel)]="password">
</div>
</div>
<button type="submit" class="login-button"><i class="fa fa-chevron-right" ></i>LOGIN</button>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
在组件中我有这个:
submitLogin(){
// Variable to hold a reference of addComment/updateComment
}
Run Code Online (Sandbox Code Playgroud)
我有登录组件:
import {Component, EventEmitter, Input, OnChanges} from '@angular/core';
import {Observable} from 'rxjs/Rx';
import { LoginService } from '../services/login.service';
import { Login } from …Run Code Online (Sandbox Code Playgroud) 我有两个组成部分,父母和孩子.在孩子我有按钮.当用户点击子节点中的那个按钮时,我想要调用父节点中的方法.有什么建议吗?
我想要实现的是在同一起始行中将项目放在另一个下面但是以div为中心.这是我的小提琴:https://jsfiddle.net/7vdbLcL9/
<div class="container">
<div id="wrapper">
<div id="inner1">Zmaja od Bosne 5</div>
<div id="inner2">71 000 Sarajevo</div>
<div id="inner3">Bosnia and Herzegovina</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
而CSS:
.container{
width:40%;
border:1px solid black;
}
#wrapper{
margin-left:auto;
margin-right:auto;
height:auto;
width:auto;
text-align:center
}
Run Code Online (Sandbox Code Playgroud)
我想得到这个:
----------------------------------
Zmaja od Bosne 5
71 000 Sarajevo
Bosnia and Herzegovina
----------------------------------
Run Code Online (Sandbox Code Playgroud) 我有这个数组,我在点击时添加值,但我想检查值是否已经在数组中,如果它什么都不做。我尝试使用 indexOf 但每次都得到相同的结果
this.fields.push(this.field);
this.field = { value: '' };
Run Code Online (Sandbox Code Playgroud) 我想防止用户未输入任何内容。我尝试过这样但它不起作用:
if(this.comment === ' '){
return;
}
Run Code Online (Sandbox Code Playgroud)
这是我的整个方法:
postComment: function(user_id,article_id) {
if(this.comment === ' '){
return;
}
else{
var article_comments = {
title: this.comment,
upovotes: this.article_comments.upovotes,
downvotes: this.article_comments.downvotes,
user_id : user_id,
article_id: article_id
};
this.comments.push({
title: this.comment,
downvotes: 0,
upvotes: 0
})
this.$http.post('/blog/article/' + article_id + '/comment', article_comments).then(function(response){
},function(response){
});
}
this.comment = "";
},
Run Code Online (Sandbox Code Playgroud)
鉴于我有这个:
<div class="col-md-11 col-sm-11 col-xs-11">
<textarea class="comment_input" placeholder="Join the discussion..." v-model="comment" @keyup.enter="postComment({{$current_user->id}},{{ $article->id}})"></textarea>
</div>
Run Code Online (Sandbox Code Playgroud) 我试图在vue.js中获取选择区域的值,但我得到一个空值.
alert(this.property_credentials.district);
Run Code Online (Sandbox Code Playgroud)
任何建议如何从选择中获得价值?
<select v-model="property_credentials.district" name="district" class="country selectpicker" id="selectCountry" data-size="10" data-show-subtext="true" data-live-search="true">
<option value="0">--Please select your district</option>
<optgroup v-for='district in districts' label="@{{district.district}}">
<option v-for='region in district.regions' value="@{{region}}" >@{{region}}</option>
</optgroup>
</select>
Run Code Online (Sandbox Code Playgroud) 我希望有这样的路线:www.test.com?procesId=12.
这是我目前的routerLink:
但是现在我得到了这个价值:
www.test.com/123
Run Code Online (Sandbox Code Playgroud)
任何建议我怎么可以在网址中添加?procesId = 12有routerLink?
我试过了:
但我没有在网址中得到问号,我也得到一个错误:
无法匹配任何路线.
我知道当我使用params时我可以得到问号,但我想将它与routerLink一起使用,因为这就是他们在这个项目中使用它的方式.
我想要的是为每次迭代添加填充左增加15px.有什么建议怎么办?这就是我到目前为止所拥有的.
getClassByValue(index){
return {
'padding-left': 15 * index + 'px'
}
}
<div class="ui-g-2" [ngClass]="getClassByValue(i)">{{orderItem.orditemnum}}</div>
Run Code Online (Sandbox Code Playgroud) 我在index.html中有这个:
<body class="light-gray">
<app-root></app-root>
<div id="preloader">
<div></div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
在app-root中我有这个:
<laylout></laylout>
Run Code Online (Sandbox Code Playgroud)
在内部布局我有一个组件,scss我想在索引上更改正文.任何建议我怎么能这样做?
.light-gray{
background: red!important;
}
Run Code Online (Sandbox Code Playgroud)
我试过,:host但这不是主要的父母我需要的东西::host :host :host.东道主主持人:)