28.io-angularjs 中文文档教程

发布于 9年前 浏览 25 项目主页 更新于 3年前

28.io AngularJS Binding

构建状态Code Climate

28.io-angularjs 是官方支持的 AngularJS 绑定 对于 28.io。 28.io 是一个查询处理平台,允许您编写跨多个数据源(关系数据库)的复杂查询; 文档存储、数据仓库甚至网络服务。

我们还有教程REST API 参考

加入我们的 28.io 支持小组,提出问题并提供反馈。

Installation

通过 Bower

$ bower install 28.io-angularjs --save

API Documentation

http://28msec.github.io/28.io-angularjs/3.1.0/

Example

angular.module('myApp', ['auth.api.28.io', 'queries.api.28.io'])
.controller('AppCtrl', function($scope, $cacheFactory, Auth, Queries){

    var projectName = 'myproject';
    var auth = new Auth('http://portal.28.io', $cacheFactory('Auth'));
    var queries = new Queries('http://' + projectName + '.28.io/v1', $cacheFactory('Queries'));

    auth.authenticate({ grant_type: 'client_credentials', email: $scope.login, password: $scope.password })
    .then(function(tokens){
        var projectToken = tokens.project_tokens['project_' + projectName];
        queries.listQueries({ visibility: 'public', token: projectToken })
        .then(function(publicQueries){
                $scope.publicQueries = publicQueries;
        })
        .catch(function(error){
            alert('Server replied: ' + error.description);
        });
    })
    .catch(function(error) {
        alert('Server replied: ' + error.description);
    });
});

Development

如果你想破解 28 .io-angularjs 本身,你需要 node.jsBower

npm install && bower install

使用 grunt 构建并测试代码: ```bash

Default task - build source and then runs unit tests

grunt

License

Apache 2

28.io AngularJS Binding

Build StatusCode Climate

28.io-angularjs is an officially supported AngularJS binding for 28.io. 28.io is a query processing platform that allows you to write complex queries accross multiple data sources - relational databases; document stores, data warehouses and even web services.

We also have tutorials and an REST API reference.

Join our 28.io Support Group to ask questions and provide feedback.

Installation

Via Bower

$ bower install 28.io-angularjs --save

API Documentation

http://28msec.github.io/28.io-angularjs/3.1.0/

Example

angular.module('myApp', ['auth.api.28.io', 'queries.api.28.io'])
.controller('AppCtrl', function($scope, $cacheFactory, Auth, Queries){

    var projectName = 'myproject';
    var auth = new Auth('http://portal.28.io', $cacheFactory('Auth'));
    var queries = new Queries('http://' + projectName + '.28.io/v1', $cacheFactory('Queries'));

    auth.authenticate({ grant_type: 'client_credentials', email: $scope.login, password: $scope.password })
    .then(function(tokens){
        var projectToken = tokens.project_tokens['project_' + projectName];
        queries.listQueries({ visibility: 'public', token: projectToken })
        .then(function(publicQueries){
                $scope.publicQueries = publicQueries;
        })
        .catch(function(error){
            alert('Server replied: ' + error.description);
        });
    })
    .catch(function(error) {
        alert('Server replied: ' + error.description);
    });
});

Development

If you'd like to hack on 28.io-angularjs itself, you'll need node.js, and Bower:

npm install && bower install

Use grunt to build and test the code: ```bash

Default task - build source and then runs unit tests

grunt

License

Apache 2

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文