Skip to content

Instantly share code, notes, and snippets.

@Qvatra
Created December 1, 2014 15:46
Show Gist options
  • Save Qvatra/a6a5c488b991c71a560d to your computer and use it in GitHub Desktop.
Save Qvatra/a6a5c488b991c71a560d to your computer and use it in GitHub Desktop.
ionic development: bindOnce.ts
/// <reference path='../../typings/angularjs/angular.d.ts' />
interface IMyDirectiveScope extends ng.IScope {
bookmarker: string;
}
angular.module('directive.bindonce', [])
.directive('bindOnce', function () {
return {
restrict: 'A',
scope: true,
link: ($scope: IMyDirectiveScope): void => {
setTimeout(() => {
$scope.$destroy();
}, 0);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment