Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
|
wiki2:typescript [2016/07/17 08:09] alfred [Inheritance] |
wiki2:typescript [2020/05/09 09:25] (actual) |
||
|---|---|---|---|
| Línea 2: | Línea 2: | ||
| ===== Basics ===== | ===== Basics ===== | ||
| + | ==== Foreach ==== | ||
| + | <code javascript> | ||
| + | for (var item of someArray) { | ||
| + | console.log(item); // 9,2,5 | ||
| + | } | ||
| + | </code> | ||
| + | |||
| ==== Functions with return type ==== | ==== Functions with return type ==== | ||
| <code javascript> | <code javascript> | ||
| Línea 9: | Línea 16: | ||
| </code> | </code> | ||
| + | ==== Getters ==== | ||
| + | <code javascript> | ||
| + | get whereSendContent () { | ||
| + | return `${AppConfig.ServerUrl}'/content`; | ||
| + | } | ||
| + | </code> | ||
| ===== Classes ===== | ===== Classes ===== | ||
| ==== Inheritance ==== | ==== Inheritance ==== | ||
| Línea 62: | Línea 75: | ||
| </code> | </code> | ||
| + | ===== Others ===== | ||
| + | |||
| + | ==== Use JavaScript ==== | ||
| + | First we need to tell that exists some variable with the needed name there: | ||
| + | <code> | ||
| + | declare let BootstrapDialog: any; | ||
| + | |||
| + | @Component({ | ||
| + | ... | ||
| + | </code> | ||
| + | Then we can use it on its code (to intercept callbacks: ''onComplete: () => { this.chartTestMethod(); }'' | ||
| + | <code javascript> | ||
| + | BootstrapDialog.show({ | ||
| + | message: 'Hi Apple!', | ||
| + | type: BootstrapDialog.TYPE_WARNING, | ||
| + | buttons: [{ | ||
| + | label: 'Button 2', | ||
| + | cssClass: 'btn-primary', | ||
| + | action: (dialogItself: any) => { | ||
| + | this.deleteMission(dialogItself); | ||
| + | } | ||
| + | }, { | ||
| + | icon: 'glyphicon glyphicon-ban-circle', | ||
| + | label: 'Button 3', | ||
| + | cssClass: 'btn-warning' | ||
| + | }, { | ||
| + | label: 'Close', | ||
| + | action: function(dialogItself: any){ | ||
| + | dialogItself.close(); | ||
| + | } | ||
| + | }] | ||
| + | }); | ||
| + | </code> | ||