angularjs ng-switch
angularjs switch NG
2023-09-27 14:27:24 时间
<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 用户登录验证模块(demo)参考总结
- Angularjs实现一个Factory
- 学习angularjs的ng-hide和ng-disabled
- AngularJS---核心特性
- 走进AngularJs(六) 服务
- 走进AngularJs(五)自定义指令----(下)
- IntelliJ IDEA安装AngularJS插件
- angularJS前台传list数组,后台springMVC接收数组
- AngularJS 五大特性,加快 Web 应用开发
- angularjs 弹出框 $modal
- [angularjs] AngularJs 知识回顾
- AngularJS模块——module
- angularJS 条件查询 品优购条件查询品牌(条件查询和列表展示公用方法解决思路 及 post请求混合参数提交方式)
- AngularJS 1.x系列:AngularJS简介及第一个应用(2)
- AngularJS 前端JS框架
- angularJS——ng-repeat="item in XXX track by $index"问题记录