search

Home  >  Q&A  >  body text

angular.js - When config routing in the angular module, an error occurred when introducing the $sce service

Which module is $sce in?
Why is there an error when trying to inject it when config routing:
Uncaught Error: [$injector:modulerr]

angular.module('marketing-module',['ngRoute','d3','ngSanitize'])
    .config(['$routeProvider','$sce',function($routeProvider,$sce){
        $routeProvider
            .when('/',{
                ...
            })
            ...;
 }]);
世界只因有你世界只因有你2831 days ago639

reply all(2)I'll reply

  • 迷茫

    迷茫2017-05-15 16:53:57

    Only things like constant provider can be injected into config, but service cannot be injected

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-15 16:53:57

    Solved it myself. Services cannot be introduced here, only service providers

    reply
    0
  • Cancelreply