2014-09-25 4 views
0

나는 내가 각도 방법으로 그것을 어떻게케이스의 요소를 숨기려면 어떻게해야합니까?

<a href="#" ng-click="clickMe()" 

<div id="wrapper" 
     data-toggle="collapse" 
     data-target="#test"> 
    texts and elements... 
</div> 

<div id='test'> 
    test div…. 
</div> 

JS

$scope.clickMe = function() { 
     //I want to collapse the test div in angularjs when I click the <a> tag. 
     //I can archive that by using the codes below but I want to use the angular   
     //way to do this 
     $('#test').collapse('hide') 
} 

같은이 각도 JS

data-toggle = 'collapse'을 제어하기 위해 노력하고 있어요? 감사!

+0

덜 jQuery를 사용하면 더 나은을 사용합니다. 일반 트위터 부트 스트랩에서 앵귤러 부트 스트랩으로 전환하는 것이 큰 성공입니다 http://angular-ui.github.io/bootstrap/ – Endless

답변

1

당신은이 작업을 수행하는 NG-쇼를 사용할 수 있고 한 범위 변수를 전환 ng를 클릭합니다.

<div ng-click="test1Showing=!test1Showing"> 
    texts and elements... 
</div> 

<div ng-show='test1Showing'> 
    test div…. 
</div> 

또는 요소를 제거하려면 display : none; ng-show 대신 ng-if를 사용할 수 있습니다.

관련 문제