ng-click

This is a wrapped for the default ngClick which allows you to specify custom behavior when an fa-surface is clicked. the wrapper is also designed to be be used on touchscreen devices. It matches all the features supported by ngClick, including ngTouch module for all types of fa-surface.

If ngTouch is requried to add touch click capabilites in non F/A elements. Add ngTouch dependence before adding famous.angular otherwise this functionality will be lost.

Dependencies

Usage

<ANY ng-click="expression">

</ANY>

Example

  Edit in Plunker
<fa-app ng-controller="ClickCtrl" id="app">
  <fa-modifier fa-size="[300, 100]">
    <fa-surface fa-background-color="'red'" ng-click="myClickHandler($event)">Click Me!  This has been clicked {{clicked}} times.</fa-surface>
  </fa-modifier>
</fa-app>
#app {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
fa-surface {
  cursor: pointer;
}
angular.module('faInputExampleApp', ['famous.angular'])
  .controller('ClickCtrl', ['$scope', function($scope) {
    $scope.clicked = 0;
    $scope.myClickHandler = function($event) {
      console.log($event);
      $scope.clicked++;
    };
}]);

ng-click on an fa-surface

ng-click can be used on an fa-surface. Internally, a Famous Surface has a .on() method that binds a callback function to an event type handled by that Surface. The function expression bound to ng-click is bound to that fa-surface's click eventHandler, and when the fa-surface is clicked, the function expression will be called.