Closed PerfectCarl closed 9 years ago
Yes, you need to follow step 4 in the readme: Add hc.marked as a module dependency to your app.
This means add hc.marked into the angular.module('myApp'
array.
Thanks for your quick reply.
I tried it. In fact here was the code I wrote:
angular.module('myApp', [
'ngRoute',
'ngSanitize',
'ngTouch',
'ui.bootstrap',
'mediaPlayer',
'izhukov.utils',
'izhukov.mtproto',
'izhukov.mtproto.wrapper',
'myApp.filters',
'myApp.services',
/*PRODUCTION_ONLY_BEGIN
'myApp.templates',
PRODUCTION_ONLY_END*/
'myApp.directives',
'myApp.controllers',
'hc.marked'
]).
config(['$locationProvider', '$routeProvider', '$compileProvider', 'StorageProvider', 'markedProvider', function($locationProvider, $routeProvider, $compileProvider, StorageProvider, markedProvider) {
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|file|blob|filesystem|chrome-extension|app):|data:image\//);
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|file|mailto|blob|filesystem|chrome-extension|app):|data:/);
if (Config.Modes.test) {
StorageProvider.setPrefix('t_');
}
$routeProvider.when('/', {templateUrl: templateUrl('welcome'), controller: 'AppWelcomeController'});
$routeProvider.when('/login', {templateUrl: templateUrl('login'), controller: 'AppLoginController'});
$routeProvider.when('/im', {templateUrl: templateUrl('im'), controller: 'AppIMController', reloadOnSearch: false});
$routeProvider.otherwise({redirectTo: '/'});
markedProvider.setOptions({gfm: true});
}]);
And then the app failed to start with the error:
Error: [$injector:modulerr] Failed to instantiate module myApp due to:
[$injector:modulerr] Failed to instantiate module hc.marked due to:
[$injector:nomod] Module 'hc.marked' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
Note the gulp file is fairly complex (at least for a newcomer like me) invoking ng-annotate and other tasks
More disturbing info: it works locally on chrome, but not on firefox.
Something is rotten in the kingdom of dependency injections
I don't see anything obvious and I'm surprised that it would work in one browser and not the other. Perhaps try referencing the unminified version in index.html since minification is happening in the gulpfile anyway.
Thanks, you've been very helpful despite this issue not being related to angular-marked
or marked
whatsoever :)
I'll try to fix my gulp setup.
Did you get this working? I am not having any luck and seems to be a similar setup.
Hello,
I'm using your provider with an angular application that doesn't use bower to manage its dependencies.
I installed the file with
bower install Hypercubed/angular-marked
and copied the files toapp/vendor
and then followed your instructions.I'm not sure that I managed to load
hc.marked
properly because when I run my app I get the dreaded error:Here are the important bits of my application:
app/vendor
Do I need to explicitly load the
hc.marked
module?