您现在的位置是:首页 > Javascript
当前栏目
[angularjs] angularjs系列笔记(四)过滤器
2023-02-18 15:47:16 时间
过滤器可以使用一个管道字符(|)添加到表达式和指令中,这不就是模板函数吗
<body> <div ng-app="Home"> <div ng-controller="Index"> 格式化字符串为小写 {{myName()|lowercase}}。 格式化字符串为大写 {{myName()|uppercase}}。 格式化数字为货币格式 {{price|currency}}。 根据某个表达式排列数组 <p ng-repeat="x in prices | orderBy:'price'">{{x.price}}</p> 。 取出数组中的子元素 <input type="text" ng-model="test"> <p ng-repeat="x in prices |filter:test | orderBy:'price'">{{x.price}}</p> 。 </div> </div> </body> <script type="text/javascript"> //实例化应用对象,参数:模块名,空数组 var app=angular.module("Home",[]); //调用Application对象的controller()方法 app.controller("Index",function($scope){ $scope.myName=function(){ return "Tao"+"ShiHan"; } $scope.price=5; $scope.prices=[{price:1},{price:5},{price:3}]; }); </script>
相关文章
- 论文解读(GCC)《Efficient Graph Convolution for Joint Node RepresentationLearning and Clustering》
- 论文解读(GraphSMOTE)《GraphSMOTE: Imbalanced Node Classification on Graphs with Graph Neural Networks》
- 论文解读(GIC)《Graph infoclust: Leveraging cluster-level node information for unsupervised graph representation learning》
- 论文解读(S^3-CL)《Structural and Semantic Contrastive Learning for Self-supervised Node Representation Learning》
- 论文解读(Graph-MLP)《Graph-MLP: Node Classification without Message Passing in Graph》
- Vue 3 + Typescript + Vite 基于jsplumb流程设计和流程流转
- js setTimeout 错误捕获
- 【JS ES6】了解学习set类型和weakset类型
- 【JS ES6】了解Symbol类型
- c++混合js编程
- js解决单线程之路 - worker的使用分析
- 快速了解JSON及JSON的使用
- JavaScript刷LeetCode之双指针技巧(下)
- 用javascript分类刷leetcode之递归&分治(图文视频讲解)
- JavaScript刷LeetCode之-双指针技巧(上)
- 用javascript分类刷leetcode23.并查集(图文视频讲解)
- 将 Vue.js 项目部署至静态网站托管,并开启 Gzip 压缩
- 论文解读(node2vec)《node2vec Scalable Feature Learning for Networks》
- 一起手写JS函数的call、apply、bind
- 记录下最近开发中fastjson的坑-fastjson出现json解析异常