forked from mgcrea/angular-strap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
58 lines (42 loc) · 1.63 KB
/
app.js
File metadata and controls
58 lines (42 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'use strict';
// bower install angular#~1.3 angular-route#~1.3 angular-animate#~1.3
// bower install angular#~1.4 angular-route#~1.4 angular-animate#~1.4
angular.module('mgcrea.ngStrapDocs', ['mgcrea.ngStrap', 'mgcrea.ngPlunkr', 'ngRoute', 'ngAnimate'])
.constant('version', 'v2.3.1')
.config(function($plunkrProvider, version) {
angular.extend($plunkrProvider.defaults, {
plunkrTitle: 'AngularStrap Example Plunkr',
plunkrTags: ['angular', 'angular-strap'],
plunkrPrivate: false,
contentHtmlUrlPrefix: 'https://rawgit.com/mgcrea/angular-strap/' + version + '/src/',
contentJsUrlPrefix: 'https://rawgit.com/mgcrea/angular-strap/' + version + '/src/'
});
})
.config(function($routeProvider, $compileProvider, $locationProvider, $sceProvider) {
// Configure html5 to get links working on jsfiddle
$locationProvider.html5Mode(false);
// Disable strict context
$sceProvider.enabled(false);
// Disable scope debug data
$compileProvider.debugInfoEnabled(false);
})
.run(function($window, $rootScope, $location, $anchorScroll, version) {
$rootScope.version = version;
// FastClick
$window.FastClick.attach($window.document.body);
// Support simple anchor id scrolling
var bodyElement = angular.element($window.document.body);
bodyElement.on('click', function(evt) {
var el = angular.element(evt.target);
var hash = el.attr('href');
if(!hash || hash[0] !== '#') return;
if(hash.length > 1 && hash[1] === '/') return;
if(evt.which !== 1) return;
$location.hash(hash.substr(1));
$anchorScroll();
});
// Initial $anchorScroll()
setTimeout(function() {
$anchorScroll();
}, 0);
});