0

I'm still new with AngularJS directives, now I'm trying to use columnize plugin but without success. This answer is a good start but won't solve my problem because Categories.get() fetches data asynchronously from the server and setting a timeout doesn't seem the solution at all.

<div columnize>
    <ul>
        <li ng-repeat="data in Categories.get()">
            <a ng-href="{{ data.uri }}">{{ data.name }}</a>
            <ul>
                <li ng-repeat="data in data.categories" ng-include="'list.html'"></li>
            </ul>
        </li>
    </ul>
</div>

Edit: Categories service.

app.factory('Categories',function ($http) {
    var categories = [],
        URL = '/categories';
    if (categories.length == 0) {
        $http.get(URL).success(function (data) {
            categories = data;
        })
    }
    return {
        get: function () {
            return categories;
        },
        ....
    };

Based on the source of my data how should make the columnize directive with the columnize jQuery plugin?

4
  • What does Categories.get() return? Are you using ngResource or is that a custom service? Commented Feb 18, 2013 at 18:16
  • Categories is a service living in the $rootscope, it returns an array, not a promise. I dont remeber why ... maybe I couldn't make it work with promises. Commented Feb 18, 2013 at 19:00
  • What's your question? Commented Feb 25, 2013 at 17:58
  • How to make the columnize directive? Commented Feb 25, 2013 at 22:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.