angularjs

Directive Controller

We can add controllers to our Custom Directives

Example

Suppose we want to convert this

​<section ng-controller="PanelController as panels">
    <ul class="nav nav-pills">...</ul>
    <div class="panel" ng-show="panels.isSelected(1)">...</div>
    <div class="panel" ng-show="panels.isSelected(2)">...</div>
    <div class="panel" ng-show="panels.isSelected(3)">...</div>
    <div class="panel" ng-show="panels.isSelected(4)">...</div>
</section>

to this

Pages

Subscribe to RSS - angularjs