K
K
KOPC18862014-11-07 17:29:53
Angular
KOPC1886, 2014-11-07 17:29:53

Why do I get an error when connecting angucomplete?

Hello!
Connected such library as angucomplete.js
But the error is produced. Unknown provider: $ sceProvider
<- $sce <-
angucompleteDirective

<script type='text/javascript' src='libs/angular.min.js'></script>
<script type='text/javascript' src='js/app.js'></script>
<script type='text/javascript' src='js/controllers.js'></script>
<script type='text/javascript' src='js/sortable.js'></script>
<script type='text/javascript' src='libs/jtruncate.js'></script>
<script type='text/javascript' src='libs/angucomplete.js'></script>
 <div class="block_search" id="blockSearch" ng-controller="Search">
        <angucomplete id="searchCatalog" placeholder="Поиск по каталогу сервисов" pause="100" url="/services-catalog/api/index.php?action=catalogSearch" minlength="3" inputclass="search_input"/>
        <a href="javascript:void(0);" id="searchMagnifier" class="magnifier"></a>
        <!--<input type="search" class="search_input" id="searchCatalog" placeholder="Поиск по каталогу сервисов">-->
        <a href="javascript:void(0);" ng-click="clear()" id="searchClear" class="search_clear"></a>
        <span class="search_example">Например, <i>такси, визитки...</i></span>
        <div class="clear"></div>
    </div>

var servicesCatalog = angular.module('servicesCatalog', [
    'catalogControllers',
    'ui.sortable',
    'angucomplete'
]);

servicesCatalog.run(function($rootScope, $http, $location, $route) {
    $rootScope.ajax = false;
    $rootScope.load_catalog = true;

    var original = $location.path;
    $location.path = function (path, reload) {
        if (reload === false) {
            var lastRoute = $route.current;
            var un = $rootScope.$on('$locationChangeSuccess', function () {
                $route.current = lastRoute;
                un();
            });
        }
        return original.apply($location, [path]);
    };
});

catalogControllers.controller('Search', ['$scope', '$routeParams', '$http',
    function($scope, $routeParams, $http, loader) {

    }]);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-11-07
Protko @Fesor

Include the angucomplete.js file before app.js and in the head section if you don't want to resolve dependencies manually or resort to some kind of require.js

N
Nikita Gushchin, 2014-11-07
@iNikNik

If you are using this library - https://github.com/darylrowland/angucomplete : then you need to use Angular version >=1.2.0. This is listed as a dependency in the bower.json file .
Similar question on stackoverflow :
Those. $sce is enabled by default in Angular 1.2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question