web - Angular2 - Bootstrap v3 datetimepicker issue in FF and IE -


i rather new clientside web development , learning how work typescript, angular2(0.27) , bootstrap. know angular2 still in heavy development, ran issue, of not sure (technology) causing it. problem has bootstrap v3 datetimepicker. more info on widget in particular can found here: https://eonasdan.github.io/bootstrap-datetimepicker/

the issue in firefox (latest) , ie11 browser, popup datetimepicker not appear, if datetimepicker code (html&js) inside angular2 application html, while in google chrome works fine. ff , ie11 work fine when put code in index.html body directly.

this widget html use:

<div class="container">     <div class="row">         <div class='col-sm-6'>             <div class="form-group">                 <div class='input-group date' id='datetimepicker1'>                     <input placeholder="raw" type='text' class="form-control" />                     <span class="input-group-addon">                         <span class="glyphicon glyphicon-calendar"></span>                     </span>                 </div>             </div>         </div>         <script type="text/javascript">         $(function () {             $('#datetimepicker1').datetimepicker();         });         </script>     </div> </div> 

the body in index.html looks this:

<body> <my-app></my-app> <script type="text/javascript">     system.config({         baseurl: '/'     });     system.import('~/app'); </script> </body> 

with my-app referring angular2 application produces html containing datetimepicker widget.

any hints on causing or how circumvent issue? tried putting '.datetimepicker()' js call in code executed on window or doc load, didn't make difference.

apparently issue here in ff , ie js inside html script blocks not executed, if these html script blocks appear inside angular2 application html template. i'm not sure if angular2 fix, or if caused way chrome/opera parse/handle differently ie , ff.

either way, got working executing datetimepicker code inside constructor of typescript angular2 application. need reference typescript definition file of datetimepicker (bootstrap.v3.datetimepicker.d.ts) , jquery , make application class constructor this:

constructor() {     $(function () {         $('#datetimepicker1').datetimepicker({             format: 'dd/mm/yyyy hh:mm'         });         console.log('executed datetimepicker angular2 app constructor');     }); } 

at constructor time of application, corresponding datetimepicker1 dom element available , js executed no matter (recent) browser using.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -