Skip to content
This repository was archived by the owner on Nov 30, 2018. It is now read-only.

Commit 5f3e287

Browse files
committed
Add FAQ section
1 parent 825fd1f commit 5f3e287

File tree

4 files changed

+77
-12
lines changed

4 files changed

+77
-12
lines changed

app/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
<li ng-class="{'active': $location.path() == '/'}"><a href="/" rel="start">Home</a></li>
5454
<li ng-class="{'active': $location.path() == '/use'}"><a href="/use" rel="help">Quickstart</a></li>
5555
<li ng-class="{'active': $location.path() == '/api'}"><a href="/api" rel="help">API documentation</a></li>
56+
<li ng-class="{'active': $location.path() == '/faq'}"><a href="/faq" rel="help">FAQ</a></li>
5657
<li ng-class="{'active': $location.path() == '/demo'}"><a href="/demo" rel="help">Demo</a></li>
5758
<li class="dropdown">
5859
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Developer resources <b class="caret"></b></a>
@@ -107,6 +108,7 @@
107108
<script src="scripts/module.js"></script>
108109
<script src="scripts/controllers/main.js"></script>
109110
<script src="scripts/controllers/use.js"></script>
111+
<script src="scripts/controllers/faq.js"></script>
110112
<script src="scripts/controllers/api.js"></script>
111113
<script src="scripts/controllers/demo.js"></script>
112114
<script src="scripts/controllers/headlines.js"></script>

app/scripts/app.js

+16-12
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ angular.module('angularGoogleMapsApp')
55
.config(function ($routeProvider, $locationProvider, $logProvider, $githubProvider, analyticsProvider) {
66

77
$locationProvider.html5Mode(true).hashPrefix('!');
8-
$logProvider.debugEnabled(false);
8+
$logProvider.debugEnabled(true);
99

1010
$githubProvider.username('nlaplante')
1111
.repository('angular-google-maps')
@@ -30,28 +30,32 @@ angular.module('angularGoogleMapsApp')
3030
templateUrl: 'views/demo.html',
3131
controller: 'DemoCtrl'
3232
})
33+
.when('/faq', {
34+
templateUrl: 'views/faq.html',
35+
controller: 'FAQCtrl'
36+
})
3337
.when('/not-found', {
34-
templateUrl: 'views/404.html',
35-
controller: 'NotFoundCtrl'
38+
templateUrl: 'views/404.html',
39+
controller: 'NotFoundCtrl'
3640
})
3741
.otherwise({
3842
redirectTo: function (params, path, search) {
3943
return '/not-found?url=' + path;
4044
}
4145
});
4246
})
43-
.run(function ($rootScope, $log, $location, analytics) {
47+
.run(function ($rootScope, $log, $location) {
4448

4549
$rootScope.$location = $location;
4650

47-
$rootScope.$on('$viewContentLoaded', function (e, current, previous) {
48-
// refresh add this if needed
49-
addthis.toolbox('.addthis_toolbox');
50-
addthis.update('.addthis_toolbox');
51-
});
51+
$rootScope.$on('$viewContentLoaded', function (e, current, previous) {
52+
// refresh add this if needed
53+
addthis.toolbox('.addthis_toolbox');
54+
addthis.update('.addthis_toolbox');
55+
});
5256

53-
$rootScope.$on('$routeChangeError', function (e, current, previous, rejection) {
54-
$log.error('could not change route', rejection);
55-
});
57+
$rootScope.$on('$routeChangeError', function (e, current, previous, rejection) {
58+
$log.error('could not change route', rejection);
59+
});
5660

5761
});

app/scripts/controllers/faq.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
angular.module('angularGoogleMapsApp')
4+
.controller('FAQCtrl', function ($scope) {
5+
});

app/views/faq.html

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<h1 class="page-header">FAQ</h1>
2+
3+
<p>Here are the most frequently asked questions about this library from the issue tracker and the Google+ community. You can suggest an addition to this list by opening an issue in the issue tracker.</p>
4+
5+
<ul>
6+
<li><a href="#faq-map-instance">How do I access the map instance?</a></li>
7+
<li><a href="#faq-map-height">Can I dynamically set the map height?</a></li>
8+
</ul>
9+
10+
<h3 id="faq-map-instance">How do I access the map instance?</h3>
11+
12+
<p>It is possible to access the map instance using the <code>tilesloaded</code> event:</p>
13+
14+
<ul class="nav nav-tabs">
15+
<li class="active"><a href="" data-target="#faq-map-instance-tab-html" data-toggle="tab">HTML</a></li>
16+
<li><a href="" data-target="#faq-map-instance-tab-script" data-toggle="tab">Script</a></li>
17+
</ul>
18+
19+
<div class="tab-content">
20+
<div id="faq-map-instance-tab-html" class="tab-pane active">
21+
<pre>&lt;google-map events="map.events" ...&gt;&lt;/google-map&gt;</pre>
22+
</div>
23+
<div id="faq-map-instance-tab-script" class="tab-pane">
24+
<pre>$scope.map = {
25+
events: {
26+
tilesloaded: function (map) {
27+
$log.info('this is the map instance', map);
28+
}
29+
}
30+
}</pre>
31+
</div>
32+
</div>
33+
34+
<h3 id="faq-map-height">Can I dynamically set the map height?</h3>
35+
36+
<p>The map's height can be set either statically using CSS or dynamically:</p>
37+
38+
<ul class="nav nav-tabs">
39+
<li class="active"><a href="" data-target="#faq-map-height-tab-html" data-toggle="tab">HTML</a></li>
40+
<li><a href="" data-target="#faq-map-height-tab-script" data-toggle="tab">Script</a></li>
41+
</ul>
42+
43+
<div class="tab-content">
44+
<div id="faq-map-height-tab-html" class="tab-pane active">
45+
<pre>&lt;google-map id="my-map" ... &gt;&lt;/google-map&gt;</pre>
46+
</div>
47+
<div id="faq-map-height-tab-script" class="tab-pane">
48+
<p>Let's assume we include the map in an <code>ng-view</code> block:</p>
49+
<pre>$scope.$on('$viewContentLoaded', function () {
50+
var mapHeight = 500; // or any other calculated value
51+
$("#my-map .angular-google-map-container").height(mapHeight);
52+
});</pre>
53+
</div>
54+
</div>

0 commit comments

Comments
 (0)