angularjs ng-switch

<p>
<a href="#" ng-click="toggle()">Toggle Section</a>
</p> <div ng-switch="section"> <p ng-switch-when="happy" bn-directive>
Oh sweet!
</p> <p ng-switch-when="sad" bn-directive>
Oh noes!
</p> </div>

js

var app = angular.module( "Demo", [] );
// 定义控制器
app.controller(
"DemoController",
function( $scope ) {
$scope.section = "happy";
//在toggle函数中改变section的值,以此在标记中显示/隐藏不同的部分
$scope.toggle = function() {
if ( $scope.section === "happy" ) {
$scope.section = "sad";
} else {
$scope.section = "happy";
}
};
}
);
angularjs ng-switch的更多相关文章
- Part 6 AngularJS ng repeat directive
ng-repeat is similar to foreach loop in C#. Let us understand this with an example. Here is what we ...
- part 4 AngularJS ng src directive
- Part 15 AngularJS ng init directive
The ng-init directive allows you to evaluate an expression in the current scope. In the following e ...
- [AngularJS] AngularJS系列(1) 基础篇
目录 什么是AngularJS? 为什么使用/ng特性 Hello World 内置指令 内置过滤器 模块化开发 一年前开始使用AngularJS(以后简称ng),如今ng已经出2了.虽说2已完全变样 ...
- 从angularJS看MVVM
javascript厚积薄发走势异常迅猛,导致现在各种MV*框架百家争雄,MVVM从MVC演变而来,为javascript注入了全新的活力.我工作的业务不会涉及到angularJS[ng]这么重量级的 ...
- angularJS看MVVM
从angularJS看MVVM javascript厚积薄发走势异常迅猛,导致现在各种MV*框架百家争雄,MVVM从MVC演变而来,为javascript注入了全新的活力.我工作的业务不会涉及到a ...
- js架构设计模式——从angularJS看MVVM
javascript厚积薄发走势异常迅猛,导致现在各种MV*框架百家争雄,MVVM从MVC演变而来,为javascript注入了全新的活力.我工作的业务不会涉及到 angularJS[ng] 这么重量 ...
- java 基础知识六 字符串2
java 基础知识六 字符串2 1.String类是final类,也即意味着String类不能被继承,并且它的成员方法都默认为final方法 . String 是不可变对象,也就是一旦创建,那么整 ...
- .Net Core应用框架Util介绍(一)
距离上次发文,已经过去了三年半,这几年技术更新节奏异常迅猛,.Net进入了跨平台时代,前端也被革命性的颠覆. 回顾 2015年,正当我还沉迷于JQuery + EasyUi的封装时,突然意识到技术已经 ...
- neo1973 audio subsystem
fhttp://wiki.openmoko.org/wiki/Neo_1973_audio_subsystem using Bluetooth headset with GSM NOTE none o ...
随机推荐
- MFC下对文件及文件夹的操作(复制、剪切、删除、创建文件夹,写文件)
一.文件夹的创建 void CFileOperationDlg::OnButtonMakeFolder() { // TODO: Add your control notification handl ...
- hdu 5493 Queue treap实现将元素快速插入到第i个位置
input T 1<=T<=1000 n 1<=n<=100000 h1 k1 h2 k2 ... ... hn kn 1<=hi<=1e9 0<=ki&l ...
- win8下使用eclipse进行hadoop2.6.2开发
最近在win平台下使用eclipse Mars做在远程linux上的hadoop2.6开发,出现很多问题,让人心力交瘁,在经过不懈努力后,终于解决了,让人欢欣雀跃. 1.安装JDK 在做hadoop2 ...
- Android自动测试之monkeyrunner工具
monkeyrunner工具 前言: 最近开始研究Android自动化测试方法,对其中的一些工具.方法和框架做了一些简单的整理,其中包括 android测试框架.CTS.Monkey.Monkeyr ...
- android之ViewStub的使用
转自http://blog.csdn.net/hitlion2008/article/details/6737537 在开发应用程序的时候,经常会遇到这样的情况,会在运行时动态根据条件来决定显示哪个V ...
- HDU 5366 The mook jong
先暴力写了一个DFS,然后找规律.. #include<cstdio> #include<cstring> #include<cmath> #include< ...
- VB.net结束进程
Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ...
- cPanel 安装方法
. 如何安装cPanel/WHM? 答:安装过程较长,建议使用screen或nohupscreen: yum -y install screen perl screen -S cpanel cd /h ...
- CSS样式与选择器
CSS构造块的样式: 1. h1{color:red;background-color:yellow} 其中:h1是选择器,花括号内是声明部分.多个声明之间用分号隔开. 2.为样式规则添加注释:/* ...
- 错误: libstdc++.so.6: cannot open shared object file: No such file or directory
解压完别人提供的openwrt代码,编译时,出现如下错误: # configuration written to .config#mips-openwrt-linux-uclibc-gcc: erro ...