AngularJS触发Controller中的滑动切换

时间:2014-12-28 13:59:02

标签: angularjs slidetoggle

我正在使用我的上下滑动效果这个天才写的.js模块。 https://github.com/EricWVGG/AngularSlideables

http://jsfiddle.net/3sVz8/19/

我可以把它包含在我的项目中,它按照我想要的方式工作。 但是现在我想在我的控制器中触发这个,我该怎么做?

HTML

<a href="" ng-click="Triggerhere();" slide-toggle="#derp">Open smoothly</a>

<div id="derp" class="slideable">
     open/hidden content
</div>

的.js

var myApp  = angular.module('myApp', ['ngAnimate', 'angularSlideables']);

angular.module('angularSlideables', [])
.directive('slideable', function () {
    return {
       all the code from the github
    })


 myApp.controller("ContactControllerHeading", function ($scope, $http) {
     $scope.Triggerhere= function() {
          /* trigger here this   slide-toggle="#derp" */
     }

  });

非常感谢

1 个答案:

答案 0 :(得分:0)

我放弃了解决它。我使用jquery上下滑动功能,这似乎是一个充分的解决方案

http://www.w3schools.com/jquery/eff_slidetoggle.asp