Skip to content

Commit 38594d1

Browse files
authored
Merge pull request #11 from mapbox/as/add-angular-source-code
Add Angular tutorial source code
2 parents 5ea40a1 + 8e07f5c commit 38594d1

27 files changed

+15722
-2
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,7 @@ fastlane/test_output
8181
/captures
8282
.externalNativeBuild
8383
.cxx
84-
local.properties
84+
local.properties
85+
86+
# Angular project files
87+
.angular/

poi-search-react/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# poi-search
22

3-
This is supporting code for the Mapbox turorial [Add Point of Interest (POI) Search to a Map in a React app](https://docs.mapbox.com/help/tutorials/poi-search-react/).
3+
This is supporting code for the Mapbox tutorial [Add Point of Interest (POI) Search to a Map in a React app](https://docs.mapbox.com/help/tutorials/poi-search-react/).
44

55
## Overview
66

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.ts]
12+
quote_type = single
13+
ij_typescript_use_double_quotes = false
14+
15+
[*.md]
16+
max_line_length = off
17+
trim_trailing_whitespace = false
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
2+
3+
# Compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
/bazel-out
8+
9+
# Node
10+
/node_modules
11+
npm-debug.log
12+
yarn-error.log
13+
14+
# IDEs and editors
15+
.idea/
16+
.project
17+
.classpath
18+
.c9/
19+
*.launch
20+
.settings/
21+
*.sublime-workspace
22+
23+
# Visual Studio Code
24+
.vscode/*
25+
!.vscode/settings.json
26+
!.vscode/tasks.json
27+
!.vscode/launch.json
28+
!.vscode/extensions.json
29+
.history/*
30+
31+
# Miscellaneous
32+
/.angular/cache
33+
.sass-cache/
34+
/connect.lock
35+
/coverage
36+
/libpeerconnection.log
37+
testem.log
38+
/typings
39+
40+
# System files
41+
.DS_Store
42+
Thumbs.db
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# use-mapbox-gl-js-with-angular
2+
3+
This is supporting code for the Mapbox tutorial [Use Mapbox GL JS in an Angular app](https://docs.mapbox.com/help/tutorials/use-mapbox-gl-js-with-angular/).
4+
5+
## Overview
6+
7+
This tutorial walks through how to setup [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js/) in an [Angular](https://angular.dev) project.
8+
9+
10+
You'll learn how to:
11+
- How to set up an Angular app using the Angular CLI.
12+
- How to install Mapbox GL JS and its dependencies.
13+
- Use Mapbox GL JS to render a full screen map.
14+
- How to add a toolbar which displays map state like `longitude`, `latitude`, and `zoom` level and is updated as the map is interacted with (showing the map to app data flow).
15+
- How to create a UI button to reset the map to its original view (showing the app to map data flow).
16+
17+
18+
## Prerequisites
19+
20+
- Node v18.20 or higher
21+
- [Angular CLI](https://angular.dev/tools/cli)
22+
- npm
23+
24+
## How to run
25+
26+
- Clone this repository and navigate to this directory
27+
- Install [Angular CLI](https://angular.dev/tools/cli) (if not already installed)
28+
- Install dependencies with `npm install`
29+
- Replace `YOUR_MAPBOX_ACCESS_TOKEN` in `src/app/map/map.component.ts` with an access token from your [Mapbox account](https://console.mapbox.com/).
30+
- Run the development server with `npm start` and open the app in your browser at [http://localhost:4200](http://localhost:4200).
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"angular-gl-js": {
7+
"projectType": "application",
8+
"schematics": {
9+
"@schematics/angular:component": {
10+
"style": "scss"
11+
}
12+
},
13+
"root": "",
14+
"sourceRoot": "src",
15+
"prefix": "app",
16+
"architect": {
17+
"build": {
18+
"builder": "@angular-devkit/build-angular:application",
19+
"options": {
20+
"outputPath": "dist/angular-gl-js",
21+
"index": "src/index.html",
22+
"browser": "src/main.ts",
23+
"polyfills": [
24+
"zone.js"
25+
],
26+
"tsConfig": "tsconfig.app.json",
27+
"inlineStyleLanguage": "scss",
28+
"assets": [
29+
{
30+
"glob": "**/*",
31+
"input": "public"
32+
}
33+
],
34+
"styles": [
35+
"src/styles.scss",
36+
"node_modules/mapbox-gl/dist/mapbox-gl.css"
37+
],
38+
"scripts": [],
39+
"server": "src/main.server.ts",
40+
"prerender": true,
41+
"ssr": {
42+
"entry": "src/server.ts"
43+
}
44+
},
45+
"configurations": {
46+
"production": {
47+
"budgets": [
48+
{
49+
"type": "initial",
50+
"maximumWarning": "500kB",
51+
"maximumError": "1MB"
52+
},
53+
{
54+
"type": "anyComponentStyle",
55+
"maximumWarning": "4kB",
56+
"maximumError": "8kB"
57+
}
58+
],
59+
"outputHashing": "all"
60+
},
61+
"development": {
62+
"optimization": false,
63+
"extractLicenses": false,
64+
"sourceMap": true
65+
}
66+
},
67+
"defaultConfiguration": "production"
68+
},
69+
"serve": {
70+
"builder": "@angular-devkit/build-angular:dev-server",
71+
"configurations": {
72+
"production": {
73+
"buildTarget": "angular-gl-js:build:production"
74+
},
75+
"development": {
76+
"buildTarget": "angular-gl-js:build:development"
77+
}
78+
},
79+
"defaultConfiguration": "development"
80+
},
81+
"extract-i18n": {
82+
"builder": "@angular-devkit/build-angular:extract-i18n"
83+
},
84+
"test": {
85+
"builder": "@angular-devkit/build-angular:karma",
86+
"options": {
87+
"polyfills": [
88+
"zone.js",
89+
"zone.js/testing"
90+
],
91+
"tsConfig": "tsconfig.spec.json",
92+
"inlineStyleLanguage": "scss",
93+
"assets": [
94+
{
95+
"glob": "**/*",
96+
"input": "public"
97+
}
98+
],
99+
"styles": [
100+
"src/styles.scss"
101+
],
102+
"scripts": []
103+
}
104+
}
105+
}
106+
}
107+
}
108+
}

0 commit comments

Comments
 (0)