我有一个HTML5日期选择器.
单击日期选择器文本框时会打开它.
去做 :
这是我的datepicker的HTML代码:
<img src="date.png" alt="Date Picker" id="datepickericon" />
<input name="calendarselect{ContactID}" class="timeselect" type="date" id="calendar">
<script>
document.getElementById("datepickericon").onclick = function(e){
console.log('inside click');
document.getElementById("calendar").style.visibility="visible";
// document.getElementById("calendar").focus();
// You could write code to toggle this
}
Run Code Online (Sandbox Code Playgroud)

点击图标我必须得到如下图所示的打开日历视图

我有以下代码:
this.isUsingGoogleTwoFactor$ = this.user$.pipe(map((user: User) =>
user.isUsingGoogleTwoFactor));
Run Code Online (Sandbox Code Playgroud)
现在我想要的是向 发出新值isUsingGoogleTwoFactor$。我知道我不能这样做,observables但我应该使用subjects. 但我不知道具体如何用管道来做。
谢谢!
我mat-autocomplete在我的 Angular 应用程序下使用小部件:
<mat-form-field class="col-md-3" color="warn">
<input type="text"
id="libelleShop"
#inputSelectShop
placeholder="Selectionner la boutique"
matInput
formControlName="libelleShop"
ngDefaultControl
[matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete""
(optionSelected)="onShopSelectionChanged($event)">
<mat-option *ngFor="let shop of shopData" [value]="shop.value">
{{shop.name}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)
我的商店数据是这样的:
shopData = [
{name: 'AAA' , value :'11'},
{name: 'BBB', value :'22'},
{name: 'CCC', value : '33'}
];
Run Code Online (Sandbox Code Playgroud)
这样的-选项被显示name,但在选择由输入displaysitvalue不是name。
知道我需要其他治疗的价值,我不会改变[value]的mat-automplete。
我如何将名称引用到输入中?
建议??
angular-material angular-material2 angular angular-material-6
尝试使用角材料在角2中实现简单的应用。
我用分页实现了一个简单的表。
我也使用了mat-select组件,但是为此,我想实现一个搜索过滤器来键入并从列表中搜索所需的选项。
<table>
<tr><td> Department</td>
<td>
<mat-form-field>
<mat-select placeholder=" ">
<mat-option> </mat-option>
<mat-option *ngFor="let dep of dept" [value]="dep">{{dep}}</mat-option>
</mat-select>
</mat-form-field><br/>
</td>
</tr>
</table>
<br><br>
<button >Search</button>
<button >Reset</button>
<button >Close</button>
<mat-card>
<div class="example-container mat-elevation-z8">
<mat-table #table [dataSource]="dataSource">
<!-- Account No. Column -->
<ng-container matColumnDef="accno">
<mat-header-cell *matHeaderCellDef> Account No. </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.accno}} </mat-cell>
</ng-container>
<!-- Account Description Column -->
<ng-container matColumnDef="accdesc">
<mat-header-cell *matHeaderCellDef> Account Description </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.accdesc}} </mat-cell>
</ng-container>
<!-- Investigator Column …Run Code Online (Sandbox Code Playgroud) 问题:
expansion-panel,它应该向上扩展以显示更多信息,而不是向下扩展,这会使用户再次向下滚动。我有一个 Angular Material Expansion Panel 查询列表:
@ViewChildren(MatExpansionPanel)
matExpansionPanelQueryList: QueryList<MatExpansionPanel>;
Run Code Online (Sandbox Code Playgroud)
和一个简单的数组:
questions: [];
Run Code Online (Sandbox Code Playgroud)
扩展面板是用*ngFor: 简化生成的,例如:
<ng-container *ngFor="let question of questions>
<mat-expansion-panel
...
Run Code Online (Sandbox Code Playgroud)
当我扩展问题数组时,我想打开最后一个扩展面板。
extendQuestion() {
this.matExpansionPanelQueryList.changes.subscribe(
change => {
change.last.open();
}
);
this.questions.push('some-new-item');
}
Run Code Online (Sandbox Code Playgroud)
这工作得很好 - 我向数组中插入了一个项目,
重新渲染了 ExpansionPanels,创建了一个新面板并且它实际上打开了 - 我的问题是它在控制台中生成以下错误:
ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has
changed after it was checked. Previous value: 'mat-expanded: false'. Current
value: 'mat-expanded: true'.
Run Code Online (Sandbox Code Playgroud)
有什么办法可以避免这种情况吗?
我曾尝试在订阅中使用changeDetectorRef和markForCheck(),但错误消息并没有消失(老实说,我 100% 确定这里的确切问题是什么)。
更新:问题的Stackblitz 示例(单击“+”按钮)
我正在尝试从 ion-select 中获取所选选项 Value
但是当我从 ion-select 中选择任何值时,我得到了Undefined值,因为我是 ionic 的新手,
我无法自己对其进行排序。
HTML:
<ion-item>
<ion-label>Quantity</ion-label>
<ion-select [(ngModel)]="number"
(ionChange)="onChange(carbrand)" >
<ion-option *ngFor="let count of quantity"
[value]="count" >{{count}}</ion-option>
</ion-select>
<!-- <ion-select [(ngModel)]="number">
<ion-option *ngFor="let count of quantity"
value="count"></ion-option>
</ion-select> -->
</ion-item>
Run Code Online (Sandbox Code Playgroud)
主页.ts :
onChange(SelectedValue){
console.log("Selected Quantity", SelectedValue);
}
Run Code Online (Sandbox Code Playgroud) 我在切换扩展上的图标时遇到问题<mat-menu>。
为了扩大下拉菜单,我使用[matMenuTriggerFor]="menu".
当我在下拉菜单外单击时,下拉菜单正在扩展和隐藏。
问题:
我不知道如何在显示下拉列表时切换<mat-icon>expand_more</mat-icon>到<mat-icon>expand_less</mat-icon>,而在隐藏下拉列表时以相反的方式切换。
我注意到[aria-expanded]="true"当显示下拉列表时,属性出现在我的一个 div 上。整个属性在关闭下拉列表时消失。
你能帮我在下拉菜单上实现切换图标吗?
正如您所看到的{{iconExpand}},我想在切换下拉列表中提供图标名称的插值。
<div class="NavbarUser" #menuTrigger="matMenuTrigger" [matMenuTriggerFor]="menu">
<tl-mat-button [noPadding]="true" [colorTheme]="'linkGrey'"
class="NavbarUserName tl-mat-padding-r-base">
{{ input.user.fullName }}
</tl-mat-button>
<tl-mat-image-thumbnail [size]="'small'" [thumbnailUrl]="input.user.thumbnailUrl">
</tl-mat-image-thumbnail>
<mat-icon class="Profile__DropdownArrow--Icon">{{iconExpand}}</mat-icon>
<mat-menu #menu="matMenu">
<div>
<hr/>
</div>
<button mat-menu-item *ngFor="let profileButton of input.dropDownPaths"
[routerLink]="profileButton.relativeUrl">
<img class="Profile__Dropdown--Icons" src="{{profileButton.iconUrl}}" />
<span class="Profile__Dropdown--Text">{{profileButton.title}}</span>
</button>
</mat-menu>
</div>
Run Code Online (Sandbox Code Playgroud) 问题 :
案例:
我尝试删除除了渲染地图所需的所有 CSS。我在看起来类似的问题上尝试了这些 CSS 技巧 :
我还尝试删除所有用于标记和信息窗口的代码。谷歌按钮仍然是空白的。它们都可以工作(缩放、街景和全屏),但它们是空白的,不符合我的目的。
我mat-select从有角材料下拉菜单。
它具有来自API的状态列表。在下拉菜单中有10多个选项。
去做 :
mat-select使用。中的“ 搜索”选项,mat-select search但这确实很难理解。请给我建议简单的方法。
我的JSON代码
"{
"data": [
{
"id": 32,
"name": "Andaman And Nicobar Islands"
},
{
"id": 16,
"name": "Odisha"
},
{
"id": 34,
"name": "Puducherry"
},
{
"id": 19,
"name": "Uttar Pradesh"
},
{
"id": 5,
"name": "Uttarakhand"
},
{
"id": 6,
"name": "Andhra Pradesh"
}
],
"statusCode": 200
}"
Run Code Online (Sandbox Code Playgroud) 问题 :
方法 :
去做 :
场景:
请建议.
谢谢.
这是现在的代码:
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.js"></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
class NameForm extends React.Component {
render() {
return (<a href="asdf.txt" onclick="$('a').hide()">this is a link</a>)
}
}
ReactDOM.render(
<NameForm />,
document.getElementById('root')
);
</script>
</body>
Run Code Online (Sandbox Code Playgroud)
新守则:
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.js"></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
class NameForm extends React.Component {
render() {
let name = "asdf" // this would be a more complicated proccess
return (<a …Run Code Online (Sandbox Code Playgroud) angular ×7
javascript ×3
html ×2
typescript ×2
accordion ×1
css ×1
database ×1
extjs ×1
google-maps ×1
html5-canvas ×1
ionic2 ×1
ionic3 ×1
material-ui ×1
postgresql ×1
reactjs ×1
rxjs ×1
sencha-touch ×1