-
Notifications
You must be signed in to change notification settings - Fork 663
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #708 from Swiip/typescript-modules
New version for Typescript 1.5 with ES6 modules and Webpack
- Loading branch information
Showing
21 changed files
with
1,236 additions
and
16,611 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
".bowerrc", | ||
".editorconfig", | ||
|
||
"tsconfig.json", | ||
"protractor.conf.js", | ||
|
||
"e2e/.jshintrc", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
module <%- appName %> { | ||
'use strict'; | ||
|
||
/** @ngInject */ | ||
export function config($logProvider: ng.ILogProvider, toastrConfig) { | ||
// enable log | ||
$logProvider.debugEnabled(true); | ||
// set options third-party lib | ||
toastrConfig.allowHtml = true; | ||
toastrConfig.timeOut = 3000; | ||
toastrConfig.positionClass = 'toast-top-right'; | ||
toastrConfig.preventDuplicates = true; | ||
toastrConfig.progressBar = true; | ||
} | ||
export /** @ngInject */ function config($logProvider: ng.ILogProvider, toastrConfig) { | ||
// enable log | ||
$logProvider.debugEnabled(true); | ||
// set options third-party lib | ||
toastrConfig.allowHtml = true; | ||
toastrConfig.timeOut = 3000; | ||
toastrConfig.positionClass = 'toast-top-right'; | ||
toastrConfig.preventDuplicates = true; | ||
toastrConfig.progressBar = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,29 @@ | ||
/// <reference path="../../<%- props.paths.tmp %>/typings/tsd.d.ts" /> | ||
|
||
<% if (props.router.key !== 'none') { %> | ||
/// <reference path="index.route.ts" /> | ||
<% } %> | ||
/// <reference path="index.config.ts" /> | ||
/// <reference path="index.run.ts" /> | ||
/// <reference path="main/main.controller.ts" /> | ||
/// <reference path="../app/components/navbar/navbar.directive.ts" /> | ||
/// <reference path="../app/components/malarkey/malarkey.directive.ts" /> | ||
/// <reference path="../app/components/webDevTec/webDevTec.service.ts" /> | ||
/// <reference path="../app/components/githubContributor/githubContributor.service.ts" /> | ||
import { config } from './index.config'; | ||
<% if (props.router.key !== 'none') { -%> | ||
import { routerConfig } from './index.route'; | ||
<% } -%> | ||
import { runBlock } from './index.run'; | ||
import { MainController } from './main/main.controller'; | ||
import { GithubContributor } from '../app/components/githubContributor/githubContributor.service'; | ||
import { WebDevTecService } from '../app/components/webDevTec/webDevTec.service'; | ||
import { acmeNavbar } from '../app/components/navbar/navbar.directive'; | ||
import { acmeMalarkey } from '../app/components/malarkey/malarkey.directive'; | ||
|
||
declare var malarkey: any; | ||
declare var moment: moment.MomentStatic; | ||
|
||
module <%- appName %> { | ||
'use strict'; | ||
|
||
angular.module('<%- appName %>', [<%- modulesDependencies %>]) | ||
.constant('malarkey', malarkey) | ||
.constant('moment', moment) | ||
.config(config) | ||
<% if (props.router.key !== 'none') { %> | ||
.config(routerConfig) | ||
<% } %> | ||
.run(runBlock) | ||
.service('githubContributor', GithubContributor) | ||
.service('webDevTec', WebDevTecService) | ||
.controller('MainController', MainController) | ||
.directive('acmeNavbar', acmeNavbar) | ||
.directive('acmeMalarkey', acmeMalarkey); | ||
} | ||
angular.module('<%- appName %>', [<%- modulesDependencies %>]) | ||
.constant('malarkey', malarkey) | ||
.constant('moment', moment) | ||
.config(config) | ||
<% if (props.router.key !== 'none') { -%> | ||
.config(routerConfig) | ||
<% } -%> | ||
.run(runBlock) | ||
.service('githubContributor', GithubContributor) | ||
.service('webDevTec', WebDevTecService) | ||
.controller('MainController', MainController) | ||
.directive('acmeNavbar', acmeNavbar) | ||
.directive('acmeMalarkey', acmeMalarkey); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
module <%- appName %> { | ||
'use strict'; | ||
|
||
/** @ngInject */ | ||
export function runBlock($log: ng.ILogService) { | ||
$log.debug('runBlock end'); | ||
} | ||
/** @ngInject */ | ||
export function runBlock($log: ng.ILogService) { | ||
$log.debug('runBlock end'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
module <%- appName %> { | ||
'use strict'; | ||
|
||
/** @ngInject */ | ||
export function routerConfig($routeProvider: ng.route.IRouteProvider) { | ||
$routeProvider | ||
.when('/', { | ||
templateUrl: 'app/main/main.html', | ||
controller: 'MainController', | ||
controllerAs: 'main' | ||
}) | ||
.otherwise({ | ||
redirectTo: '/' | ||
}); | ||
} | ||
/** @ngInject */ | ||
export function routerConfig($routeProvider: ng.route.IRouteProvider) { | ||
$routeProvider | ||
.when('/', { | ||
templateUrl: 'app/main/main.html', | ||
controller: 'MainController', | ||
controllerAs: 'main' | ||
}) | ||
.otherwise({ | ||
redirectTo: '/' | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
module <%- appName %> { | ||
'use strict'; | ||
/** @ngInject */ | ||
export function routerConfig($stateProvider: ng.ui.IStateProvider, $urlRouterProvider: ng.ui.IUrlRouterProvider) { | ||
$stateProvider | ||
.state('home', { | ||
url: '/', | ||
templateUrl: 'app/main/main.html', | ||
controller: 'MainController', | ||
controllerAs: 'main' | ||
}); | ||
|
||
/** @ngInject */ | ||
export function routerConfig($stateProvider: ng.ui.IStateProvider, $urlRouterProvider: ng.ui.IUrlRouterProvider) { | ||
$stateProvider | ||
.state('home', { | ||
url: '/', | ||
templateUrl: 'app/main/main.html', | ||
controller: 'MainController', | ||
controllerAs: 'main' | ||
}); | ||
|
||
$urlRouterProvider.otherwise('/'); | ||
} | ||
$urlRouterProvider.otherwise('/'); | ||
} |
38 changes: 17 additions & 21 deletions
38
app/templates/src/app/components/githubContributor/_githubContributor.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,22 @@ | ||
module <%- appName %> { | ||
'use strict'; | ||
export class GithubContributor { | ||
public apiHost: string = 'https://api.github.com/repos/Swiip/generator-gulp-angular'; | ||
|
||
export class GithubContributor { | ||
public apiHost: string = 'https://api.github.com/repos/Swiip/generator-gulp-angular'; | ||
private $log: ng.ILogService; | ||
private $http: ng.IHttpService; | ||
|
||
private $log: ng.ILogService; | ||
private $http: ng.IHttpService; | ||
|
||
/** @ngInject */ | ||
constructor($log: ng.ILogService, $http: ng.IHttpService) { | ||
this.$log = $log; | ||
this.$http = $http; | ||
} | ||
/** @ngInject */ | ||
constructor($log: ng.ILogService, $http: ng.IHttpService) { | ||
this.$log = $log; | ||
this.$http = $http; | ||
} | ||
|
||
getContributors(limit: number = 30) { | ||
return this.$http.get(this.apiHost + '/contributors?per_page=' + limit) | ||
.then((response: any) => { | ||
return response.data; | ||
}) | ||
.catch((error: any) => { | ||
this.$log.error('XHR Failed for getContributors.\n', error.data); | ||
}); | ||
} | ||
getContributors(limit: number = 30) { | ||
return this.$http.get(this.apiHost + '/contributors?per_page=' + limit) | ||
.then((response: any) => { | ||
return response.data; | ||
}) | ||
.catch((error: any) => { | ||
this.$log.error('XHR Failed for getContributors.\n', error.data); | ||
}); | ||
} | ||
} |
Oops, something went wrong.