Skip to content

Instantly share code, notes, and snippets.

@victorb
Created February 3, 2014 20:47
Show Gist options
  • Select an option

  • Save victorb/8792069 to your computer and use it in GitHub Desktop.

Select an option

Save victorb/8792069 to your computer and use it in GitHub Desktop.
angular.module('silviaModule.Slider', ['ngSanitize'])
.directive('svSlider', function() {
return {
restrict: 'E',
scope: {
'ngModel': '='
},
template: '<div ng-bind-html="slide"></div>',
controller: function($scope, $sce) {
$scope.$watch('ngModel', function(newVal) {
if(newVal) {
var slide = newVal.html();
slide = "<slide>" + slide + "</slide>";
$scope.slide = $sce.trustAsHtml(slide);
}
})
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment