Skip to content

Commit 1b88c8b

Browse files
committed
added babel pollyfill, created about/aboutComp/aboutComponent.js and added scss file
1 parent c323ff0 commit 1b88c8b

File tree

11 files changed

+55
-18
lines changed

11 files changed

+55
-18
lines changed

.babelrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2-
"presets": ["@babel/preset-env", "@babel/preset-react"],
2+
"presets": [
3+
"@babel/preset-env",
4+
"@babel/preset-react"
5+
],
36
"plugins": ["angularjs-annotate", "@babel/plugin-syntax-dynamic-import"]
47
}

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
},
2020
"homepage": "https://github.com/nimjetushar/angularjs-react#readme",
2121
"dependencies": {
22+
"@babel/polyfill": "^7.0.0",
2223
"@uirouter/angularjs": "^1.0.20",
2324
"angular": "1.7.4",
2425
"bootstrap": "^4.1.3",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div class="about-container">
2+
<h3>About</h3>
3+
<p></p>
4+
</div>

src/about/aboutComponent.js renamed to src/about/aboutComp/aboutComponent.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import "./aboutComponent.scss"
2+
13
aboutCtrl.$inject = [];
24

35
function aboutCtrl() {}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.about-container {
2+
}

src/about/aboutComponent.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/about/aboutModule.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
import angular from "angular";
2-
import uiRouter from "@uirouter/angularjs";
32

4-
import aboutComponent from "./aboutComponent";
3+
import aboutComponent from "./aboutComp/aboutComponent";
54

65
const ABOUT_MODULE = angular
76
.module("AboutModule", [])
87
.config([
9-
"$stateProvider",
10-
function($stateProvider) {
11-
$stateProvider.state("about", {
8+
"$stateRegistryProvider",
9+
function($stateRegistry) {
10+
// any two of the way can be used
11+
$stateRegistry.register({
12+
name: "about",
1213
url: "/about",
1314
component: "aboutComponent"
1415
});
16+
// $stateProvider.state("about", {
17+
// url: "/about",
18+
// component: "aboutComponent"
19+
// });
1520
}
1621
])
1722
.component("aboutComponent", aboutComponent);

src/header/headerComponent.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
22
<a class="navbar-brand" href="#">Angular React</a>
3-
<button class="navbar-toggler" aria-expanded="false" aria-label="Toggle navigation">
3+
<button class="navbar-toggler" aria-expanded="false" aria-label="Toggle navigation"
4+
ng-click="toggleNav()">
45
<span class="navbar-toggler-icon"></span>
56
</button>
67

7-
<div class="collapse navbar-collapse">
8+
<div class="collapse navbar-collapse" ng-class="{'show': isNavOpen}">
89
<ul class="navbar-nav mr-auto">
9-
<li class="nav-item">
10+
<li class="nav-item" ui-sref-active="active">
1011
<a class="nav-link" ui-sref="landing">Home</a>
1112
</li>
12-
<li class="nav-item">
13+
<li class="nav-item" ui-sref-active="active">
1314
<a class="nav-link" ui-sref="about">About</a>
1415
</li>
15-
<li class="nav-item">
16+
<li class="nav-item" ui-sref-active="active">
1617
<a class="nav-link" ui-sref="help">Help</a>
1718
</li>
1819
</ul>

src/header/headerComponent.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
headerCtrl.$inject = [];
1+
headerCtrl.$inject = ["$scope"];
22

3-
function headerCtrl() {}
3+
function headerCtrl($scope) {
4+
$scope.isNavOpen = false;
5+
6+
$scope.toggleNav = function() {
7+
$scope.isNavOpen = !$scope.isNavOpen;
8+
};
9+
}
410

511
export default {
612
templateUrl: "./headerComponent.html",

vendor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import angular from "angular";
22
import uiRouter from "@uirouter/angularjs";
3+
import "@babel/polyfill";
34

45
import 'bootstrap/scss/bootstrap.scss'

0 commit comments

Comments
 (0)