ng-admin如何连接远程服务器

时间:2016-06-28 11:24:57

标签: angularjs ng-admin

我是ng-admin的绿色手,问题是: 是否可以连接到远程服务器以获取数据?比如。

var admin = nga.application(' QDNS Admin')         .baseApiUrl(' http://remote主持人/');

非常感谢提前

2 个答案:

答案 0 :(得分:0)

enter image description here

在您的admin.js文件中,您必须像这样配置您的API端点:

myApp.config(['NgAdminConfigurationProvider', function (nga) {
    // create an admin application
    var admin = nga.application('Name of your Admin')
      .baseApiUrl('http://localhost:8080/api/');
    //if you have an entity called users

    nga.configure(admin);
}
在您的server.js中,您必须定义路径

答案 1 :(得分:0)

enter image description here

在您的admin.js文件中,您必须像这样配置您的API端点:

myApp.config(['NgAdminConfigurationProvider', function (nga) {
    // create an admin application
    var admin = nga.application('Name of your Admin')
      .baseApiUrl('http://localhost:8080/api/');
    //if you have an entity called users
    // the API endpoint for this entity will be 'http://localhost:8080/api/users/
    var user = nga.entity('users').identifier(nga.field('_id'));
        user.listView()
.fields([
	nga.field('username'),
    nga.field('email'),
    nga.field('password'),
    nga.field('lastname'),
    nga.field('firstname'),
    nga.field('created_at'),
    nga.field('updated_at')
    ]);
    admin.addEntity(user);
    nga.configure(admin);
}

在您的server.js中,您必须定义一个路径

相关问题