堆栈上的菜鸟溢出来了.我正在开发一个具有转移工作职能的网页.这允许用户选中复选框以将作业发送回办公室,或从所有可用列表中选择技术人员.我的问题是如何设置复选框,以便在页面加载时默认选中它并相应地禁用选择列表.这是我目前的代码:
<div ng-app="">
Send to Office: <input type="checkbox" ng-model="checked" ng-checked="true"><br/>
<select id="transferTo" ng-disabled="checked">
<option>Tech1</option>
<option>Tech2</option>
</select>
</div>
Run Code Online (Sandbox Code Playgroud)
这是一个jsfiddle:http://jsfiddle.net/hugmungus/LvHJw/5/
目前,页面加载并选中复选框,但未禁用列表.如果取消选中然后重新检查,则列表将被禁用.
谢谢您的帮助!
背景:
我正在研究一个过渡策略的概念证明,我们正在调查这个过程将把"旧的"webapp引入iFrame,同时我们将现有的功能转换为Angular.
问题:
我遇到的问题是尝试在iFrame上设置src标记.我正在尝试使用DomSanitationService组件,但即使启用此选项,我仍会收到"不安全的URL"错误消息.
码:
这是我现在拥有的; 我尝试在从服务接收URL后擦除组件中的URL.
http.component.ts
import { Component, OnInit } from '@angular/core';
import { HttpService } from './http.service';
import { SafeResourceUrl, DomSanitizationService } from '@angular/platform-browser';
@Component({
selector: 'http-frame',
template: `
<h1>Angular Frame</h1>
<iframe [src]='page'></iframe>
`,
providers: [
HttpService,
DomSanitizationService
]
})
export class HttpComponent implements OnInit {
page:string = '';
constructor(
private httpService: HttpService,
private sanitizer: DomSanitizationService
) {};
ngOnInit(){
this.httpService.getPage()
.then(page => {
console.log(page);
this.page = this.sanitizer.bypassSecurityTrustResourceUrl(page);
console.log(this.page);
});
}
}
Run Code Online (Sandbox Code Playgroud)
http.service.ts
import { Injectable } …Run Code Online (Sandbox Code Playgroud)