Built-in Components

NgIF

1 <div *ngIf="false"></div> <!-- never displayed -->
2 <div *ngIf="a > b"></div> <!-- displayed if a is more than b -->
3 <div *ngIf="str == ‘yes‘"></div> <!-- displayed if str holds the string "yes" -->
5 <div *ngIf="myFunc()"></div> <!-- displayed if myFunc returns a true value -->

NgSwitch

<div class="container" [ngSwitch]="myVar">
    <div *ngSwitchCase="‘A‘">Var is A</div>
    <div *ngSwitchCase="‘B‘">Var is B</div>
    <div *ngSwitchDefault>Var is something else</div>
</div>

NgStyle

<div>
    <span [ngStyle]="{color: ‘red‘}" [style.font-size.px]="fontSize">
        red text
    </span>
</div>

NgClass

<div [ngClass]="classesObj">
    Using object var. Border {{ classesObj.bordered ? "ON" : "OFF" }}
</div>

NgFor

<h4 class="ui horizontal divider header">
    Simple list of strings
</h4>

<div class="ui list" *ngFor="let c of cities">
    <div class="item">{{ c }}</div>
</div>

Geting an index

<div class="ui list" *ngFor="let c of cities; let num = index">
    <div class="item">{{ num+1 }} - {{ c }}</div>
</div>

NgNonBindable

1 <div class=‘ngNonBindableDemo‘>
2     <span class="bordered">{{ content }}</span>
3     <span class="pre" ngNonBindable>
4          This is what {{ content }} rendered
5     </span>
6 </div>    

时间: 2024-11-03 05:21:12

Built-in Components的相关文章

[zz] Principal Components Analysis (PCA) 主成分分析

http://matlabdatamining.blogspot.com/2010/02/principal-components-analysis.html 英文Principal Components Analysis的博客,写的挺好,担心以后打不开,全文转载. Principal Components Analysis Introduction Real-world data sets usually exhibit relationships among their variables.

react笔记

注意事项: 1 Note that native HTML element names start with a lowercase letter, while custom React class names begin with an uppercase letter. 1 请注意原生HTML元素的名字以小写字母开头,而自定义的React类名字以大写字母开头: 特别注意:不管是原生HTML还是自定义React类其最高层元素(本例中comment-box类)不能出现兄弟及元素,且文本内容不得出

Architecture Components

1.Why "Architecture" Components? 2.what does architecture components include? { Room //a robust SQL object mapping library ViewModel //provide data for UI components and survive configuration changes LiveData  //monitor changes,database observer

PatentTips - System and method to deprivilege components of a virtual machine monitor

BACKGROUND INFORMATION An embodiment of the present invention relates generally to virtualization platforms and, more specifically, to a system and method to run components of a virtual machine monitor at a reduced privilege level. Various mechanisms

ExtJS笔记5 Components

参考 :http://blog.csdn.net/zhangxin09/article/details/6914882 An Ext JS application's UI is made up of one or many widgets called Components. All Components are subclasses of theExt.Component class which allows them to participate in automated lifecycl

点点滴滴Vue-cli (三) Vue components

这一章开始介绍这个框架在项目中的实际应用,这一节我们先简单开始vue组件的使用,在这个小项目中我们将做一个简单的图书管理系统.最后项目会是怎么样我也还不是很清楚,只是一步一步的往下做.当然在这里也会涉及到 css的编写,因为这块内容不是本系列文章的重点,所以我们就简单的把他直接写在组件里面,在真实项目中都会抽成一个单独的css文件,然后进行压缩等处理. 好了,现在就开始我们的项目吧.在整个页面的首页我们大致会有三个组件,分别是header,footer 还有中间显示内容的body 部分.首先我们

eclipse工程总是提示红叉,但是没有看到哪出错了!The project was not built due to &quot;Could not delete

最近在编译web project的时候,页面总是提示xx方法没有被定义为xx类.但是明明都是正确的. 而且在工程上有个红叉但是程序并没有看到哪有错误.如下图: 解决方法: 1.先打开problem窗口,才能看到意想不到的错误. Window-show view-other-找到problem.然后就会看到一条错误.如下: The project was not built due to "Could not delete '/build/com'.". Fix the problem,

App 组件化/模块化之路——Android 框架组件(Android Architecture Components)使用指南

面对越来越复杂的 App 需求,Google 官方发布了Android 框架组件库(Android Architecture Components ).为开发者更好的开发 App 提供了非常好的样本.这个框架里的组件是配合 Android 组件生命周期的,所以它能够很好的规避组件生命周期管理的问题.今天我们就来看看这个库的使用. 通用的框架准则 官方建议在架构 App 的时候遵循以下两个准则: 关注分离 其中早期开发 App 最常见的做法是在 Activity 或者 Fragment 中写了大量

Android Studio中的App Components重要点记述

阅读英文文档而理解的file:///E:/Android2016/sdk/docs/guide/components/fundamentals.html#Components App Compnents 每个component都是系统可以进入你的app的一种方式,但是不是所有的component都是对于user而言的真实的entry points. 共有四种app components: Activity: 每一个activity代表用户界面的一个单独的屏幕,这些activity是相互独立的 S

Building Maintainable Software-java篇之Keep Architecture Components Balanced

Building encapsulation boundaries is a crucial skill in software architecture. -George H. Fairbanks in Just Enough Architecture Guideline: ? Balance the number and relative size of top-level components in your code. ? Do this by organizing source cod