Search code examples
angularjsangular-strap

Two way binding for angular strap


I'm fairly new to angularjs and am using angular strap to use some of their features like aside.

So basically I have a function like this:

  $scope.myAside = function() {
    $aside({
        title: 'My Title', 
        show: true, 
        animation: 'am-slide-left', 
        placement:'left',
        contentTemplate: 'views/aside.html'
    });
};  

and I wanted to know how to use the two binding to get 'show' to display on the page. I basically wanted something like this on the page:

The aside is open: {{myAside.show}}

I read through their setup but couldn't find anything about two binding and how to know if the aside modal is open or not.

Here is the plugin with the documentation about aside. http://mgcrea.github.io/angular-strap/#/asides


Solution

  • You need to use {{ myAside.$scope.$isShown }}

    Here is a plnkr showing how this works.