angular 시작 - 필터 사용자 정의

1541 단어

  
    
    
	<script src="E:\global\js\angular.min.js"> </script>
  
  
	<div ng-controller="c1">
		<input value="get the filter value" type="button" ng-click="getFilter()"/>
		<div ng-bind="name "/>
		<div ng-bind="name | f1:'test page'" ng-show="isShow"/>
	</div>
	
	<script>
		var app=angular.module('app1',[]);
		app.controller('c1',['$scope',function($scope){
			$scope.name="please input the pw";
			$scope.isShow=false;
			$scope.getFilter=function(){
					$scope.isShow=true;
			}
		}])
		app.filter('f1',function(){
			return function(str,filterString){
				return str+':custom:'+filterString;
			}
		})
	</script>
  

</code></pre> 
   </div> 
   <p> </p> 
   <p> </p> 
   <div class="cnblogs_Highlighter"> 
    <pre><code>app.filter('f1',function(){
			return function(str,filterString){
				return str+':custom:'+filterString;
			}
		})
</code></pre> 
   </div> 
   <p> </p> 
  </div> 
  <p> :https://www.cnblogs.com/benchan2015/p/4806782.html</p> 
 </div> 
</div>
                            </div>
                        </div>

좋은 웹페이지 즐겨찾기