在比较日期时更改行的颜色

时间:2017-11-29 03:41:41

标签: angular firebase

我正在使用firebase和angular2。在firebase中,我正在保存用户信息:名称,付费日期和截止日期。    我的html文件如下所示:

class RemoteUserMiddleware(MiddlewareMixin):
    """
    Middleware for utilizing Web-server-provided authentication.
    If request.user is not authenticated, then this middleware attempts to
    authenticate the username passed in the ``REMOTE_USER`` request header.
    If authentication is successful, the user is automatically logged in to
    persist the user in the session.
    The header used is configurable and defaults to ``REMOTE_USER``.  Subclass
    this class and change the ``header`` attribute if you need to use a
    different header.
    """
    ...
    def process_request(self, request):
        ...
        # We are seeing this user for the first time in this session, attempt
        # to authenticate the user.
        user = auth.authenticate(request, remote_user=username)
        if user:
            # User is valid.  Set request.user and persist user in the session
            # by logging the user in.
            request.user = user
            auth.login(request, user)

我想要做的是,更改 <div> <label>Today's date:</label> {{todaysdate'}}</div> <ul *ngFor="let member of members" class="collection"> <li class="collection-item" item-width="100%"> <label>NAME:</label>{{member.name}} <label>Paid Date:</label>{{member.paiddate}} <label> Due Date:</label>{{member.duedate}} </li> </ul> 的每一行的颜色。有人会建议我或参考我应该遵循的正确链接吗?

谢谢!

1 个答案:

答案 0 :(得分:4)

我会创建一个自定义的css类,如:

.redBackground {
    background-color:red
}

然后使用angular

将表达式绑定到它
<li [class.redBackground]="duedate >= todaysdate">