Angular 2: Difference between revisions
add a typescript block |
add a link to Angular 2 by Examples |
||
(43 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Angular 2 by Examples]] | |||
= Running the app (via npm) = | |||
Compile just once. This executable binary is founder under <span class="shell">./npm_modules/.bin/</span> folder. | |||
< | <source lang="bash"> | ||
$ tsc | |||
</source> | |||
</ | |||
If <code>tsc</code> is not directly available. It can also be run this way: <code>npm run tsc</code>. | |||
If you want the server to watch for changes and compile on change (aka transpile) you can run the following command: | |||
<source lang="bash"> | |||
$ npm run tsc:w | |||
</source> | |||
== turn off connection logging == | |||
Setting logConnection to false in bs-config.json did not work. The connection is logged by a middleware called connect-logger and you can disable it by creating <span class="package">bs-config.js</span> with the following content. | |||
</ | |||
<source lang="js" highlight="2"> | |||
module.exports = { | |||
server: { middleware: { 0: null }} | |||
}; | |||
</source> | |||
== turn off file change updates == | |||
Add <span class="shell">logFileChanges</span> line to disable logging of file change updates. | |||
<source lang="js" highlight="3"> | |||
module.exports = { | |||
server: { middleware: { 0: null }}, | |||
logFileChanges: false | |||
}; | |||
</source> | |||
= Event = | |||
An example event binding. | |||
<source lang="ts"> | |||
<button (click)="onSave()">Save</button> | |||
</source> | |||
Canonical form: | |||
<source lang="ts"> | |||
<button on-click="onSave()">Save</button> | |||
</source> | |||
[https://developer.mozilla.org/en-US/docs/Web/Events List of events that can be used on MDN.] |
Latest revision as of 12:52, 8 July 2016
Running the app (via npm)
Compile just once. This executable binary is founder under ./npm_modules/.bin/ folder.
$ tsc
If tsc
is not directly available. It can also be run this way: npm run tsc
.
If you want the server to watch for changes and compile on change (aka transpile) you can run the following command:
$ npm run tsc:w
turn off connection logging
Setting logConnection to false in bs-config.json did not work. The connection is logged by a middleware called connect-logger and you can disable it by creating bs-config.js with the following content.
module.exports = {
server: { middleware: { 0: null }}
};
turn off file change updates
Add logFileChanges line to disable logging of file change updates.
module.exports = {
server: { middleware: { 0: null }},
logFileChanges: false
};
Event
An example event binding.
<button (click)="onSave()">Save</button>
Canonical form:
<button on-click="onSave()">Save</button>