Skip to content

Commit ed141e3

Browse files
author
Dave Syer
committed
Add bootstrap CSS
1 parent 105528b commit ed141e3

File tree

5 files changed

+125
-65
lines changed

5 files changed

+125
-65
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Now create an angular app:
6363

6464
```
6565
$ ./ng new client
66-
$ rm -rf client/node*
66+
$ rm -rf client/node* client/src/favicon.ico
6767
$ mv client src/main
6868
$ sed -i -e 's,dist,../../../target/classes/static,' src/main/client/.angular-cli.json
6969
$ mv ng npm src/main/client
@@ -151,3 +151,23 @@ Add
151151
```
152152

153153
and then the client app will be compiled during the Maven build.
154+
155+
https://medium.com/codingthesmartway-com-blog/using-bootstrap-with-angular-c83c3cee3f4a
156+
157+
```
158+
$ cd src/main/client
159+
$ ./npm install bootstrap@3 jquery --save
160+
```
161+
162+
and update `.angular-cli.json` to add the new content:
163+
164+
```
165+
"styles": [
166+
"styles.css",
167+
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
168+
],
169+
"scripts": [
170+
"../node_modules/jquery/dist/jquery.min.js",
171+
"../node_modules/bootstrap/dist/js/bootstrap.min.js"
172+
],
173+
```

src/main/client/.angular-cli.json

Lines changed: 67 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,69 @@
11
{
2-
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3-
"project": {
4-
"name": "client"
5-
},
6-
"apps": [
7-
{
8-
"root": "src",
9-
"outDir": "../../../target/classes/static",
10-
"assets": [
11-
"assets",
12-
"favicon.ico"
13-
],
14-
"index": "index.html",
15-
"main": "main.ts",
16-
"polyfills": "polyfills.ts",
17-
"test": "test.ts",
18-
"tsconfig": "tsconfig.app.json",
19-
"testTsconfig": "tsconfig.spec.json",
20-
"prefix": "app",
21-
"styles": [
22-
"styles.css"
23-
],
24-
"scripts": [],
25-
"environmentSource": "environments/environment.ts",
26-
"environments": {
27-
"dev": "environments/environment.ts",
28-
"prod": "environments/environment.prod.ts"
29-
}
30-
}
31-
],
32-
"e2e": {
33-
"protractor": {
34-
"config": "./protractor.conf.js"
35-
}
36-
},
37-
"lint": [
38-
{
39-
"project": "src/tsconfig.app.json",
40-
"exclude": "**/node_modules/**"
41-
},
42-
{
43-
"project": "src/tsconfig.spec.json",
44-
"exclude": "**/node_modules/**"
45-
},
46-
{
47-
"project": "e2e/tsconfig.e2e.json",
48-
"exclude": "**/node_modules/**"
49-
}
50-
],
51-
"test": {
52-
"karma": {
53-
"config": "./karma.conf.js"
54-
}
55-
},
56-
"defaults": {
57-
"styleExt": "css",
58-
"class": {
59-
"spec": false
60-
},
61-
"component": {}
62-
}
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"project": {
4+
"name": "client"
5+
},
6+
"apps": [
7+
{
8+
"root": "src",
9+
"outDir": "../../../target/classes/static",
10+
"assets": [
11+
"assets",
12+
"favicon.ico"
13+
],
14+
"index": "index.html",
15+
"main": "main.ts",
16+
"polyfills": "polyfills.ts",
17+
"test": "test.ts",
18+
"tsconfig": "tsconfig.app.json",
19+
"testTsconfig": "tsconfig.spec.json",
20+
"prefix": "app",
21+
"styles": [
22+
"styles.css",
23+
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
24+
],
25+
"scripts": [
26+
"../node_modules/jquery/dist/jquery.min.js",
27+
"../node_modules/bootstrap/dist/js/bootstrap.min.js"
28+
],
29+
"environmentSource": "environments/environment.ts",
30+
"environments": {
31+
"dev": "environments/environment.ts",
32+
"prod": "environments/environment.prod.ts"
33+
}
34+
}
35+
],
36+
"e2e": {
37+
"protractor": {
38+
"config": "./protractor.conf.js"
39+
}
40+
},
41+
"lint": [
42+
{
43+
"project": "src/tsconfig.app.json",
44+
"exclude": "**/node_modules/**"
45+
},
46+
{
47+
"project": "src/tsconfig.spec.json",
48+
"exclude": "**/node_modules/**"
49+
},
50+
{
51+
"project": "e2e/tsconfig.e2e.json",
52+
"exclude": "**/node_modules/**"
53+
}
54+
],
55+
"test": {
56+
"karma": {
57+
"config": "./karma.conf.js"
58+
}
59+
},
60+
"defaults": {
61+
"styleExt": "css",
62+
"class": {
63+
"spec": false
64+
},
65+
"component": {
66+
67+
}
68+
}
6369
}

src/main/client/package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/client/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
"@angular/platform-browser": "^4.2.4",
2222
"@angular/platform-browser-dynamic": "^4.2.4",
2323
"@angular/router": "^4.2.4",
24+
"bootstrap": "^3.3.7",
2425
"core-js": "^2.4.1",
26+
"jquery": "^3.2.1",
2527
"rxjs": "^5.4.2",
2628
"zone.js": "^0.8.14"
2729
},
Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,34 @@
11
package com.example.demo;
22

3+
import java.util.HashMap;
4+
import java.util.Map;
5+
import java.util.UUID;
6+
37
import org.springframework.boot.SpringApplication;
48
import org.springframework.boot.autoconfigure.SpringBootApplication;
9+
import org.springframework.stereotype.Controller;
10+
import org.springframework.web.bind.annotation.GetMapping;
11+
import org.springframework.web.bind.annotation.ResponseBody;
512

613
@SpringBootApplication
14+
@Controller
715
public class DemoApplication {
816

9-
public static void main(String[] args) {
10-
SpringApplication.run(DemoApplication.class, args);
11-
}
17+
@GetMapping("/resource")
18+
@ResponseBody
19+
public Map<String, Object> home() {
20+
Map<String, Object> model = new HashMap<String, Object>();
21+
model.put("id", UUID.randomUUID().toString());
22+
model.put("content", "Hello World");
23+
return model;
24+
}
25+
26+
@GetMapping(value = "/{path:[^\\.]*}")
27+
public String redirect() {
28+
return "forward:/";
29+
}
30+
31+
public static void main(String[] args) {
32+
SpringApplication.run(DemoApplication.class, args);
33+
}
1234
}

0 commit comments

Comments
 (0)