Skip to content

Commit 9787010

Browse files
committed
Added ES2015+ examples
1 parent 69108e2 commit 9787010

File tree

16 files changed

+129
-44
lines changed

16 files changed

+129
-44
lines changed

src/app/api/module.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Tools from './tools.service';
2+
3+
const ApiModule = 'app.api';
4+
5+
export default ApiModule;
6+
7+
angular
8+
.module(ApiModule, [])
9+
.service('Tools', Tools);

src/app/api/tools.service.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const tools = [{
2+
name: 'AngularJS',
3+
href: 'https://angularjs.org',
4+
image: 'https://raw.githubusercontent.com/angular/angular.js/master/images/logo/AngularJS.exports/AngularJS-medium.png'
5+
}, {
6+
name: 'webpack',
7+
href: 'https://webpack.js.org/',
8+
image: 'https://raw.githubusercontent.com/webpack/media/master/logo/icon.png'
9+
}, {
10+
name: 'ES2015+',
11+
href: 'https://devhints.io/es6',
12+
image: 'https://cdn-images-1.medium.com/max/785/1*j8TtXep5psnKxDEQeffPfg.png'
13+
}, {
14+
name: 'Babel',
15+
href: 'https://babeljs.io/',
16+
image: 'https://raw.githubusercontent.com/babel/logo/master/babel.png'
17+
}, {
18+
name: 'ESLint',
19+
href: 'https://eslint.org/',
20+
image: 'https://eslint.org/img/logo.svg'
21+
}, {
22+
name: 'Angular UI Router',
23+
href: 'https://ui-router.github.io/',
24+
image: 'https://ui-router.github.io/images/logos/ui-router.svg'
25+
}, {
26+
name: 'Sass',
27+
href: 'http://sass-lang.com/',
28+
image: 'http://sass-lang.com/assets/img/logos/logo-b6e1ef6e.svg'
29+
}];
30+
31+
class ToolsService {
32+
get() {
33+
return Promise.resolve(tools);
34+
}
35+
}
36+
37+
export default ToolsService;

src/app/common/_common.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import './footer';
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export const footer = {
1+
export default {
22
template: require('./footer.html')
33
};
File renamed without changes.

src/app/common/module.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import FooterComponent from './footer.component';
2+
3+
const CommonModule = 'app.common';
4+
5+
export default CommonModule;
6+
7+
angular
8+
.module(CommonModule, [])
9+
.component('footer', FooterComponent);

src/app/hello/_hello.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ hello {
1414
size: 18px;
1515
}
1616

17-
a {
17+
.tool {
1818
align-items: center;
1919
background-position: center center;
2020
background-repeat: no-repeat;

src/app/hello/hello.component.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class HelloController {
2+
/** @ngInject */
3+
constructor($window, $log) {
4+
this.window = $window;
5+
this.log = $log;
6+
}
7+
8+
$onInit() {
9+
this.log.info('Available tools:', this.tools);
10+
}
11+
12+
open(tool) {
13+
this.window.open(tool.href, '_blank');
14+
}
15+
}
16+
17+
export default {
18+
bindings: {
19+
tools: '<'
20+
},
21+
template: require('./hello.html'),
22+
controller: HelloController
23+
};

src/app/hello/hello.html

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ <h1>AngularJS + webpack seed project</h1>
33
<p>Congratulations, you have correctly installed and run this seed project based on:</p>
44

55
<div class="tools">
6-
<a ng-repeat="tool in $ctrl.tools"
7-
ng-href="{{::tool.href}}"
8-
title="{{::tool.name}}"
9-
style="background-image: url({{::tool.image}})"
10-
target="_blank">
11-
</a>
6+
<div class="tool"
7+
style="background-image: url({{::tool.image}})"
8+
ng-repeat="tool in $ctrl.tools"
9+
ng-click="$ctrl.open(tool)">
10+
</div>
1211
</div>

0 commit comments

Comments
 (0)