这是我的演示代码:
//Imports and decorators up here for Angular 2
export class ProductsListComponent {
products = [
{ name: "A", color: "Blue", size: 50 },
{ name: "B", color: "Blue", size: 60 },
{ name: "C", color: "Black", size: 70 }
];
filters = {
colors: ["Blue", "Black"],
sizes: [70, 50]
};
//This is my first approach but just works for the colors array inside filters object
//and i have no ideia how to filter sizes too
filterProducts() {
let results …Run Code Online (Sandbox Code Playgroud) 我通过以下命令用2条路线构建了一个简单的angular应用程序:
ng build --aot --prod --base-href ./
Run Code Online (Sandbox Code Playgroud)
然后我打开index.html位于dist文件夹中的文件,应用程序运行,但是路由不起作用,并且在控制台上收到以下警告:
希望能很好地解释我的问题。提前致谢。
服务演示代码:
public class Login : UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
if (new ProjectContext().Users.Count(x => x.Username == userName && x.Password == password) == 0)
{
throw new FaultException("Invalid login");
}
}
}
Run Code Online (Sandbox Code Playgroud)
客户代码演示:
internal bool LoginOnWcf(string address, string password)
{
try
{
service.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
service.ClientCredentials.UserName.UserName = address;
service.ClientCredentials.UserName.Password = password;
user = service.GetUserById(address);
return true;
}
catch (FaultException ex)
{
MessageBox.Show(ex.Message);
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
Web.config演示:
<behaviors>
<serviceBehaviors>
<behavior name="defaultProfile">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug …Run Code Online (Sandbox Code Playgroud) 我正在学习NgRx,但我不明白为什么实体选择器触发动作.我一直在寻找原因,但我没有找到任何东西.也许我错过了一些NgRx/Entity的基础知识.
这是我的演示代码:
selectors.ts
export const selectHeroState: MemoizedSelector<object, HeroesState> = createFeatureSelector<HeroesState>('heros');
export const selectHeroes: (state: object) => Hero[] = heroAdapter.getSelectors(selectHeroState).selectAll;
Run Code Online (Sandbox Code Playgroud)
component.ts
ngOnInit() {
//this.store$.dispatch(new GetAll()); I thought this line of code was nescessary to fetch all data from store...
this.heroes$ = this.store$.select(selectHeroes); //but i just need this one as it triggers the Get All action
}
Run Code Online (Sandbox Code Playgroud)
我希望能很好地解释我的问题.提前致谢.
下一个代码...
<div *ngFor="let parent of parents">
<div *ngFor="let child of parent.children">{{child.name}}</div>
</div>
Run Code Online (Sandbox Code Playgroud)
...生成下一个html。
<div>
<div>Mary</div>
</div>
<div>
<div>John</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我的目标是产生一般的single div,如下所示:
<div>Mary</div>
<div>John</div>
Run Code Online (Sandbox Code Playgroud)
我希望已经很好地解释了我的问题。提前致谢。
angular ×5
build ×2
typescript ×2
c# ×1
css ×1
exception ×1
javascript ×1
ngrx ×1
wcf ×1
xaml ×1