Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <title>test</title>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular.min.js"></script>
- <script>
- var app = angular.module('Test', []);
- app.controller('TestController', function ($scope) {
- $scope.onSelected = function () {
- console.log('onSelected', arguments);
- };
- });
- app.directive('myFoo', function () {
- return {
- restrict: 'E',
- template: '<button type="button" ng-click="testFunc(47)">Test</button>',
- scope: {
- selected: '&'
- },
- controller: function ($scope) {
- $scope.testFunc = function (x) {
- console.log('testFunc', x);
- $scope.selected(x);
- };
- }
- };
- });
- </script>
- </head>
- <body ng-app='Test'>
- <div ng-controller='TestController'>
- <my-foo selected='onSelected' />
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement