G
G
Greg Popov2016-07-17 19:04:52
Angular
Greg Popov, 2016-07-17 19:04:52

Is it nice to accept data like this in Angular?

Post.query({name: $stateParams.name}, function (res) {
        $scope.post = res[0];

    });

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osher, 2016-07-17
@miraage

Да, только используйте controllersAs синтаксис, а не пишите напрямую в scope.
// EDIT
И, да, Post.query должен возвращать Promise.

Николай, 2016-07-17
@healqq

Некрасиво, красиво, когда query возвращает promise, и далее все при помощи promise'ов разруливается. так синтаксис выглядит единообразнее.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question