nitweb: move doc-down model to doc-down module
[nit.git] / share / nitweb / javascripts / docdown.js
index 0095c81..2b96d19 100644 (file)
@@ -16,7 +16,7 @@
 
 (function() {
        angular
-               .module('docdown', ['model', 'ngSanitize'])
+               .module('docdown', ['ngSanitize'])
 
                .config(function($stateProvider, $locationProvider) {
                        $stateProvider
                                })
                })
 
+               .factory('DocDown', [ '$http', function($http) {
+                       return {
+                               postMarkdown: function(md, cb, cbErr) {
+                                       $http.post('/api/docdown', md)
+                                               .success(cb)
+                                               .error(cbErr);
+                               }
+                       }
+               }])
+
                .controller('DocdownCtrl', ['$sce', '$scope', '$location', 'DocDown', function($sce, $scope, $location, DocDown) {
 
                        this.updateSnippet = function() {