From 5e3233541e53586c3e6a431808b2ffa1495d77db Mon Sep 17 00:00:00 2001 From: Hypercubed Date: Tue, 21 Jan 2014 17:31:41 +0900 Subject: [PATCH] Issue with Kama.conf.js --- angular-marked.js | 18 +++++++++--------- karma.conf.js | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/angular-marked.js b/angular-marked.js index b0458db..fec2d0d 100644 --- a/angular-marked.js +++ b/angular-marked.js @@ -13,12 +13,7 @@ var app = angular.module('hc.marked', []); - app.constant('marked', marked); - - // Maybe this is better? - //app.service('marked', ['$window', function($window) { - // return $window.marked; - //}]); + app.constant('marked', window.marked); // TODO: filter tests */ //app.filter('marked', ['marked', function(marked) { @@ -35,12 +30,17 @@ }, link: function (scope, element, attrs) { var value = scope.marked || element.text() || ''; - element.html(marked(value, scope.opts || null)); + set(); - if (attrs.marked) + function set() { + element.html(marked(value, scope.opts || null)); + } + + if (attrs.marked) { scope.$watch('marked', function(value) { element.html(marked(value || '', scope.opts || null)); - }); + }); + } } }; diff --git a/karma.conf.js b/karma.conf.js index e40a65f..72d1ad7 100755 --- a/karma.conf.js +++ b/karma.conf.js @@ -15,8 +15,8 @@ module.exports = function(config) { files: [ 'bower_components/angular/angular.js', 'bower_components/angular-mocks/angular-mocks.js', - 'angular-marked.js', 'bower_components/marked/lib/marked.js', + 'angular-marked.js', 'test/spec/**/*.js' ],