Skip to content

Commit 451e4b6

Browse files
authored
Merge pull request #2562 from angular-fullstack/ts-private-public-functions
Ts private public functions
2 parents 46a8456 + f1cb9ac commit 451e4b6

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Diff for: src/generators/generator-base.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,19 @@ export class Base extends YoBase {
4949
to() {
5050
return this.filters.expect ? ').to' : '.should';
5151
}
52+
53+
public() {
54+
return this.filters.ts ? 'public ' : '';
55+
}
56+
private() {
57+
return this.filters.ts ? 'private ' : '';
58+
}
5259
}
5360

5461
export class NamedBase extends Base {
5562
constructor(...args) {
5663
super(...args);
57-
64+
5865
this.argument('name', { type: String, required: true });
5966

6067
var name = this.name.replace(/\//g, '-');

Diff for: templates/app/client/app/main/main.component.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ import { SocketService } from '../../components/socket/socket.service';
88
styles: [require('./main.<%=styleExt%>')],
99
})
1010
export class MainComponent implements OnInit<% if(filters.socketio) { %>, OnDestroy<% } %> {
11-
Http;
1211
<%_ if(filters.socketio) { -%>
1312
SocketService;<% } %>
1413
awesomeThings = [];
1514
<%_ if(filters.models) { -%>
1615
newThing = '';<% } %>
1716

18-
static parameters = [Http, SocketService];
19-
constructor(_Http_: Http<% if(filters.socketio) { %>, _SocketService_: SocketService<% } %>) {
20-
this.Http = _Http_;
17+
<%_ if(filters.babel) { -%>
18+
static parameters = [Http, SocketService];<% } %>
19+
constructor(<%= private() %>http: Http<% if(filters.socketio) { %>, <%= private() %>socketService: SocketService<% } %>) {
20+
this.Http = http;
2121
<%_ if(filters.socketio) { -%>
22-
this.SocketService = _SocketService_;<% } %>
22+
this.SocketService = socketService;<% } %>
2323
}
2424

2525
ngOnInit() {

0 commit comments

Comments
 (0)