我有两节课
class Phone extends Observable
{
@observable String type = '';
@observable String provider = '';
@observable String num = '';
Map<String, Map<String, String> map = {};
Phone() {}
Phone.build({ this.type,
this.provider,
this.num });
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用字段值作为地图中的键,如下所示
Phone phone = new Phone();
phone.map[phone.type] = {'type':'cell', 'provider':'Verizon', 'num':'1234567'};
Run Code Online (Sandbox Code Playgroud)
但它不起作用。如何使字段值成为地图的键?
我正在使用"primeng":"^ 4.0.0-rc.2"和"@ angular/cli":"^ 1.0.0"和angular4.当我尝试使用对话框时,对话框无法访问 - 它隐藏在叠加层后面,应阻止访问页面的其余部分.请参见下图
我希望对话框可以点击,但手机用户界面是unlickagle.鳕鱼的片段如下所示:
<p-confirmDialog width = "425"
class = 'dialog-z-index'></p-confirmDialog>
Run Code Online (Sandbox Code Playgroud)
confirm() {
this._confirmationSrvc.confirm(
{
message: `Are you sure you want to delete the phone entry? ${
jsonStringify( this.deletionData )}`,
header: 'Delete Confirmation',
icon: 'fa fa-trash',
accept: () => {
}
} )
}
onDeleteConfirm( event ): void {
this.deletionData = event.data as IPhone
this.isDialog = true
if ( this.isDialog ) {
this.confirm()
event.confirm.resolve()
event.source.onChangedSource.subscribe(
changedSrc => {
if ( this.currentData.length < 1 ) { …Run Code Online (Sandbox Code Playgroud) 我正在尝试迭代列表以创建一个选择下拉框.我的代码在下面显示为Web组件
<!DOCTYPE html>
<polymer-element name="epimss-name">
<template>
<label for='titleCmbo' id='titleLbl'>Title</label>
<template repeat="{{title in titleList}}">
<select id='titleCmbo'>
<option value='{{title}}'>{{title}}</option>
</select>
</template>
</template>
<script type="application/dart">
import 'package:polymer/polymer.dart';
@CustomTag( 'epimss-name' )
class NameElement extends PolymerElement
{
final List<String> titleList = toObservable([ '', 'Dr', 'Miss', 'Mr', 'Mrs', 'Prof' ]);
}
</script> </polymer-element>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
代码是,它为每次迭代创建一个单独的组合.如果我将标签移到嵌套模板之外,编辑器会抱怨.
这样做的正确方法是什么?
谢谢
我试图理解在Dart中使用async和await.不知何故,我在某些方法中返回值时遇到问题.
请考虑以下代码
Future<int> getMrn() async {
var mrnRef = await firebaseClient.child('mrn');
DataSnapshot ss;
StreamSubscription<Event> onValueSubscription = await mrnRef.onValue
.listen((event) {
ss = event.snapshot;
return ss.val();
});
//return Future<int> ss.val();
}
Run Code Online (Sandbox Code Playgroud)
mrn是int应该通过getMrn方法返回的类型.但是每次返回都会ss.val()返回null.似乎ss = event.snapshot在最后返回的值中没有看到
这样做的正确方法是什么.谢谢
我有以下内容:
import {
OnInit, Component, ChangeDetectionStrategy, ViewChild, ElementRef,
AfterViewInit
} from 'angular2/core'
import {Observable} from 'rxjs/Observable';
..
export class NameCmp implements AfterViewInit{
....
@ViewChild('card')
card: ElementRef;
mouseMoves$: Observable<MouseEvent>;
ngAfterViewInit(): void {
this.mouseMoves$ = Observable.fromEvent(this.card.nativeElement, 'mousemove');
this.mouseMoves$.subscribe( event => console.log('logging mousemove'));
console.log('after view init')
}
Run Code Online (Sandbox Code Playgroud)
...
<md-card #card>
<md-card-content>
<md-input
required
placeholder = "Title"
[ngFormControl] = "titleCtrl"></md-input>
</md-card-content>
</md-card>
Run Code Online (Sandbox Code Playgroud)
但是,虽然console.log('after view init')打印到控制台,但console.log('logging mousemove'));声明却没有.
谢谢
我在 JavaScript 正则表达式中有以下正则表达式
(https?|ftp)://([-A-Z0-9.]+)(/[-A-Z0-9+&@#/%=~_|!:,.;]*)?(\?[A-Z0-9+&@#/%=~_|!:??,.;]*)?
Run Code Online (Sandbox Code Playgroud)
它尝试验证并清空空格或 URL。
然而,当我尝试在 Dart RegExp 中使用它时
使用 Perle 风格的正则表达式,它不会验证。
任何帮助表示赞赏。
我正在试验以下种子来自https://github.com/NathanWalker/angular2-seed-advanced
我有以下src文件:
app.component.ts
import { ChangeDetectionStrategy } from 'angular2/core';
import { RouteConfig } from 'angular2/router';
import { NameListService } from '../../frameworks/app.framework/index';
import {
RouteComponent, AnalyticsService
} from '../../frameworks/core.framework/index';
import { LangSwitcherComponent } from '../../frameworks/i18n.framework/index';
import { NavbarComponent } from './navbar.component';
import { ToolbarComponent } from './toolbar.component';
import { HomeComponent } from '../home/home.component';
import { AboutComponent } from '../about/about.component';
import { PatientComp } from '../../frameworks/epimss.framework/components/reg/patient/patient.comp';
@RouteComponent({
selector : 'sd-app',
viewProviders : [NameListService],
templateUrl : './components/app/app.component.html',
directives : [LangSwitcherComponent, NavbarComponent, ToolbarComponent], …Run Code Online (Sandbox Code Playgroud) I have the following code
void onSelectionChangedFiredSources( Event event, var detail,
SelectCheckboxMenuComponent target)
{
// getItemModels returns a list of objects
getItemModels( target.selectedItems )
..forEach( (item)
{
switch( item.label )
{
case 'Ear':
toggleDialog( 'paper-dialog-transition-center',
$['ear-side-dialog']);
break;
case 'Eye':
toggleDialog( 'paper-dialog-transition-center',
$['eye-side-dialog']);
break;
case 'Nostril':
toggleDialog( 'paper-dialog-transition-center',
$['nostril-side-dialog']);
break;
case 'Thorax':
toggleDialog( 'paper-dialog-transition-center',
$['thorax-side-dialog']);
break;
default:
srcDataMap.add( item.label, item.selected);
}
});
}
Run Code Online (Sandbox Code Playgroud)
When a case is triggered, I would like to break out of the foreach loop.
Note that each …
dart ×5
angular ×3
dart-polymer ×2
angular-cli ×1
javascript ×1
perl ×1
primeng ×1
regex ×1
rxjs5 ×1