yalabot / angular-foundation

http://pineconellc.github.io/angular-foundation/
Other
1.05k stars 267 forks source link

Close button not working #184

Closed blanchma closed 9 years ago

blanchma commented 9 years ago
<alert id="errors" type="danger" class="radius" close >
  <p ng-repeat="error in errors" class="error_msg">{{error}}</p>
</alert>

The close button is rendered but when I click it, nothing happen.

fulup-bzh commented 9 years ago

I have the same issue. I check the source code and I fail to understand why. The alert template generate a ng-click='close()' that should close the alert box as soon as we click on it, doesn't it ?

jbrowning commented 9 years ago

The alert directive declares the following scope:

scope: {
  type: '=',
  close: '&'
}

Thus, when the close button is clicked, the expression within the close attribute is evaluated. It is up to you to actually remove the alert element from the DOM (this is usually accomplished via a ng-if, ng-show, or ng-hide).

The documentation is lacking here. :no_mouth:

fulup-bzh commented 9 years ago

Thank you for this quick response. It effectively works. Oviously the chosen var name has to be unique to each alert box, or in one click you close all of them.

 <alert data-ng-hide="closeAlert1" close="closeAlert1=true"> dfsdfsdf</alert>
 <alert data-ng-hide="closeAlert2" close="closeAlert2=true"> 1234</alert>
blanchma commented 9 years ago

Many thanks!