jquery - Unable to make to directive work for OwlCarousel -


everything working in dom. elements being created. plugin fails render template. doing wrong? problem dont know if plugin failing or angular directive not working properly?

please see here: http://plnkr.co/edit/mcw307yxpdtuhxzzvxuo?p=preview please right click , inspect .owl-carousel element during preview mode.

a few things:

  • scope.$watch used watching isolate scope properties, not attributes, watching attributes need use attrs.$observe.

  • what meaning of passing in directive template here:

    <div class="owl-carousel" data="data" options="{items : 4, scrollperpage : true }" template="'item.html'" ></div>

you've passed directive template in directive definition templateurl already.

  • when pass variable directive, , if variable expect change , want ui bindings updating accordingly, case images array here, should use isolate scope instead of attribute pass data directive. use attributes, few gotchas, first must pass in attribute directive evaluating first (using {{}}), otherwise gets passed in directive string "data":

<div class="owl-carousel" data="{{data}}"

not:

<div class="owl-carousel" data="data"

the latter case ok if passe din data through isolate scope.

see working plunk.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -