Вопрос

I am trying to implement the datepicker plugin developped by eternicode and I am experiencing some hurdles with ng-view.

I found similar cases but none helped me solving this (e.g. controller in the routeProvider) :

When my datepicker is inside index.html it works fine, but when I use a template view, the calendar doesn't popup.

Here's a plunkr to illustrate this case : plunkr

<div ng-view></div>

  <div class="container">
      <div class="col-lg-2">
          <div class="input-group date">
              <input type="text" class="form-control"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
          </div>
      </div>
  </div>
Это было полезно?

Решение

At the time when the js is running at the bottom of your index.html file, the view hasn't been loaded yet.

I moved the plugin code initialization code to the controller to demonstrate that it will work if the code is executed after the view has been loaded. You may want to rethink how you are setting up your app.

Plunker: http://plnkr.co/edit/PDX500tp5QgcjIMIbig1?p=preview

UPDATED: using a directive instead: http://plnkr.co/edit/LVKHkmNrTS2Ki7uP8Hgj?p=preview

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top