我正在使用角度4应用程序,在这里我需要使用角度DatePipe获取当前日期和时间.
我希望以下列格式获取日期和时间
dd-mm-yyyy hh:MM:ss AM/PM
我通过使用Angular DatePipe获得了预期,如下所示
<p>{{today | date:'dd-MM-yyyy hh:mm:ss a':'+0530'}}</p>
Run Code Online (Sandbox Code Playgroud)
输出:
10-05-2018 03:28:57 PM
Run Code Online (Sandbox Code Playgroud)
在这里,我想要做的是从app.component.ts获取相同的输出而不触及HTML
所以我尝试了下面的代码,但它生成了一个13位数的时间戳
today = Date.now();
fixedTimezone = this.today;
Run Code Online (Sandbox Code Playgroud)
那么如何在不使用HTML的情况下从app.component.ts文件中获取所提及格式的日期和时间.
我正在Angular4应用程序中工作,我想根据条件处理跨度(启用/禁用)。
当购物车中没有物品时,我要禁用跨度。
但是,当购物车中至少有1件商品时。跨度将被启用。
<span class=" notification-counter badge badge-danger" data-toggle="modal" data-target="#exampleModal" style="cursor: pointer;">{{nCount}}</span>
Run Code Online (Sandbox Code Playgroud)
从HTML或打字稿方面,我该如何处理。
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { DatePipe } from '@angular/common';
import { HostListener } from '@angular/core';
import {CartdataService} from './cartdata.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{
nCount : string;
constructor(private CartdataService:CartdataService,private http: HttpClient) { }
ngOnInit() {
this.CartdataService.cast.subscribe(Count=> this.nCount = Count);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用Android应用程序,因此我想在将屏幕旋转到横向模式时为底部导航选项卡设置全宽。
activit_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/Conslayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:animateLayoutChanges="true"
android:layoutMode="opticalBounds"
android:background="?android:attr/windowBackground"
app:itemBackground="?android:attr/windowBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/navigation"
app:itemIconTint="@color/color_selector"
app:itemTextColor="@color/color_selector" />
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
在此视图中,我想将底部导航选项卡设置为与屏幕上的“选项卡”布局一样完整。
谢谢。
我知道我不是第一个在这里问这个问题的人,我可以找到很多与我的问题相关的解决方案,但没有解决我的问题。,
图片 :
网页配置
<system.webServer>
<rewrite>
<rules>
<rule name="AngularJS Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
索引.html
<base href ="/eCommerceWebsite/">
Run Code Online (Sandbox Code Playgroud)
IIS 中的物理路径
C:\eCommerceWebsite
Run Code Online (Sandbox Code Playgroud)
谁能告诉我我在哪里犯了错误以及我需要在这里改变什么
编辑 :
图1:
图 2:
更新了 web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="AngularJS Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" …Run Code Online (Sandbox Code Playgroud)