我已经构建了一个ul并且只想在第一个li元素上设置类.
我想class="active"在第一个李上设置唯一的.我确实得到了class属性的索引,但这不是我想要的.
import { Component, View, NgFor,Inject,forwardRef,Input, NgIf, FORM_DIRECTIVES } from 'angular2/angular2';
@Component({
selector: 'tabs'
})
@View({
template: `
<ul>
<li *ng-for="#tab of tabs;#index = index" class="{{index}}" (click)="selectTab(tab)">{{tab.tabTitle}}</li>
</ul>
<ng-content></ng-content>
`,
directives: [NgFor]
})
export class Tabs {
get tabs() {
return this._tabs;
}
set tabs(value) {
this._tabs = value;
}
private _tabs;
constructor() {
console.log("ctor.Tabs");
this._tabs = [];
}
selectTab(tab) {
this._tabs.forEach((tab) => {
tab.active = false;
});
tab.active = true;
}
addTab(tab: …Run Code Online (Sandbox Code Playgroud)我想要一个可以与任何Flags样式枚举一起使用的通用函数来查看是否存在标志.
这不会编译,但如果有人有建议,我会很感激.
public static Boolean IsEnumFlagPresent<T>(T value,T lookingForFlag)
where T:enum
{
Boolean result = ((value & lookingForFlag) == lookingForFlag);
return result ;
}
Run Code Online (Sandbox Code Playgroud) 我有一个usercontrol,当一个属性发生更改时,绑定会针对许多不同的嵌入式控件(在同一个用户控件中)进行更改.在我浪费太多时间之前,这可以用Trigger或DataTrigger完成吗?我可以在后面的代码中做到这一点,但这看起来很"脏".
我一直在研究WPF应用程序,我正在使用ModelViewViewModel设计模式.我有一些来自视图的事件,导致ViewModel活动.
从UnitTest获得这些事件的合理方法是什么?例如,我想模拟drop事件.我真的不想构建一个存根视图,只是为了提升事件.
欢迎任何建议.
谢谢.
我想更改角度材质垫卡上的全局默认填充。
在angular.json中,我有以下规范:
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles/app.theme.scss",
"src/styles/styles.scss"
],
Run Code Online (Sandbox Code Playgroud)
我在styles.scss内部进行调整
.mat-card {
margin: 5px;
padding: 5px;}
Run Code Online (Sandbox Code Playgroud)
结果是边距有效,而填充无效。这是devtools中的结果。我看到其中有一个.mat卡<style>优先。
如何在全局基础上设置填充mat-card?
我需要围绕 Node.js 命令行实用程序\模块进行一些测试。不涉及浏览器,并且我使用大量“fs”模块来工作文件系统,因此我不确定基于浏览器的测试机制是否有效(沙箱)。
有什么模块可以帮助这里吗?
我想有一个简单的帮助方法将字符串转换为枚举.类似于以下内容,但它不喜欢T作为Enum.Parse中的第一个参数.错误是T是类型参数,但是像变量一样使用.
public static T StringToEnum<T>(String value)
{
return (T) Enum.Parse(T,value,true) ;
}
Run Code Online (Sandbox Code Playgroud) 使用Red-Gate工具,我们检测到System.Windows.DataObject持有对一个dragObject(一个框架元素)的引用,该对象从完成后的操作中徘徊不前.
一旦DragDrop.DoDragDrop,如何"清除"拖动对象?有没有办法通过这个传递一个null并让它直接通过?
我想将 Angular 2/Typescript 与 PouchDb 和 PouchDb-Find 与使用 Angular-cli(现在基于 webpack)生成的项目一起使用。PouchDb 通过一个简单的导入语句连接。
import * as PouchDB from 'pouchdb'
var commonDb = new PouchDB(this.commonDbUrl) ;
console.log("commonDb",commonDb) ;
// .getIndexes() is from pouchDb.find. I don't know what the import for it is
commonDb.getIndexes().then(function (result) {
console.log("GetIndexes.Success",result) ;
}).catch(function (err) {
console.log("GetIndexes.Failed",err) ;
});
Run Code Online (Sandbox Code Playgroud)
新的 PouchDb 有效,而 commonDb.getIndexes 无效。我尝试了很多变体import * as pouchfind from 'pouchdb-find'都无济于事。
如何导入 PouchDb-Find 模块?
我正在使用angular2,我正在做一个http get来检索位于的配置文件 http://MYSITE.azurewebsites.net/config/UIVisuals.json
wwwroot/config/UIVisuals.json使用filezilla查看站点时,该文件确实存在.
当我在本地运行时一切正常.当我部署到azure时,我在文件上获得了404.
如果我把网址放入浏览器 The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
更新:
我已经在我的网站上启用了目录浏览,现在我可以浏览到该目录,查看该文件.如果我双击它,我得到了The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
因此,这有效地将我的应用程序从图片中删除,使其更像是一个天蓝色的东西.
在这里做什么是天蓝色的事情?
angular ×4
wpf ×3
c# ×2
azure ×1
data-binding ×1
enum-flags ×1
enums ×1
mvvm ×1
node.js ×1
pouchdb ×1
triggers ×1
unit-testing ×1
webpack ×1