/**
 * angular-strap
 * @version v2.3.2 - 2015-09-15
 * @link http://mgcrea.github.io/angular-strap
 * @author Olivier Louvignes <olivier@mg-crea.com> (https://github.com/mgcrea)
 * @license MIT License, http://www.opensource.org/licenses/MIT
 */
'use strict';angular.module('mgcrea.ngStrap.navbar',[]).provider('$navbar',function(){var t=this.defaults={activeClass:'active',routeAttr:'data-match-route',strict:!1};this.$get=function(){return{defaults:t}}}).directive('bsNavbar',['$window','$location','$navbar',function(t,a,r){var e=r.defaults;return{restrict:'A',link:function(t,r,n,i){var c=angular.copy(e);angular.forEach(Object.keys(e),function(t){angular.isDefined(n[t])&&(c[t]=n[t])}),t.$watch(function(){return a.path()},function(t,a){var e=r[0].querySelectorAll('li['+c.routeAttr+']');angular.forEach(e,function(a){var r=angular.element(a),e=r.attr(c.routeAttr).replace('/','\\/');c.strict&&(e='^'+e+'$');var n=new RegExp(e,'i');n.test(t)?r.addClass(c.activeClass):r.removeClass(c.activeClass)})})}}}]);
//# sourceMappingURL=../modules/navbar.min.js.map
/**
 * angular-strap
 * Touched by ottemo to fire on $locationChangeSuccess
 *
 * @version v2.3.2 - 2015-09-15
 * @link http://mgcrea.github.io/angular-strap
 * @author Olivier Louvignes <olivier@mg-crea.com> (https://github.com/mgcrea)
 * @license MIT License, http://www.opensource.org/licenses/MIT
 */
(function(){
'use strict';

angular.module('mgcrea.ngStrap.navbar', [])

.provider('$navbar', function() {

    var defaults = this.defaults = {
        activeClass: 'active',
        routeAttr: 'data-match-route',
        strict: false
    };

    this.$get = function() {
        return {
            defaults: defaults
        };
    };

})

.directive('bsNavbar', [
    '$window', '$location', '$rootScope', '$navbar',
    function($window, $location, $rootScope, $navbar) {

        var defaults = $navbar.defaults;

        return {
            restrict: 'A',
            link: function postLink(scope, element, attr, controller) {

                // Directive options
                var options = {};
                angular.extend(options, defaults);

                // Fire once on load, and then every location change
                evaluatePath(options);
                $rootScope.$on('$locationChangeSuccess', function() {
                    evaluatePath(options);
                });

                ////////////////

                function evaluatePath(options) {
                    var path = $location.path();
                    var liElements = element[0].querySelectorAll('li[' + options.routeAttr + ']');

                    angular.forEach(liElements, function(li) {

                        var liElement = angular.element(li);
                        var pattern = liElement.attr(options.routeAttr).replace('/', '\\/');
                        if (options.strict) {
                            pattern = '^' + pattern + '$';
                        }
                        var regexp = new RegExp(pattern, 'i');

                        if (regexp.test(path)) {
                            liElement.addClass(options.activeClass);
                        } else {
                            liElement.removeClass(options.activeClass);
                        }
                    });
                }
            }

        };

    }
]);

})();
fix bug in navbar directive for adding an active class