'use strict';

/* global CartUtility */
module.exports = function($scope, $location, $anchorScroll, $dataService, $editorService) {
    CartUtility.log('CartBlogNewCtrl');

    $scope.aceEditor = $editorService.createEditor('markdown-edit', 'markdown-preview', CartUtility.getPureAbsUrlFromLocation($location));

    $scope.toggleToc = CartUtility.toggleToc;

    $scope.$on('$routeChangeStart', function() {
        // anchor link logic
        var prevHash = $location.hash();
        $location.hash(CartUtility.escapeAnchorName(prevHash));
        $anchorScroll();
        $location.hash(prevHash);
    });
};
'use strict';

/* global CartUtility */
module.exports = function($scope, $location, $anchorScroll, $dataService, $editorService) {
    CartUtility.log('CartBlogNewCtrl');

    $scope.aceEditor = $editorService.createEditor('markdown-edit', 'markdown-preview', CartUtility.getPureAbsUrlFromLocation($location));

    $scope.toggleToc = CartUtility.toggleToc;

    $scope.$on('$routeChangeStart', function() {
        CartUtility.log('CartBlogNewCtrl $routeChangeStart entered!');
        // anchor link logic
        var prevHash = $location.hash();
        if (typeof prevHash === 'string' && prevHash !== '') {
            $location.hash(CartUtility.escapeAnchorName(prevHash));
            $anchorScroll();
            $location.hash(prevHash);
        }
    });
};
Add status check.