0

我第一次尝试使用 ng-admin。我只是按照示例进行操作,但在浏览器中看不到任何内容。我的代码很少,所以不确定我做错了什么。

有任何想法吗?我没有正确安装吗?我刚从一个网站下载它并解压缩文件。

<!DOCTYPE html>
<html>
   <head>
       <meta charset="utf-8">
       <title>My First Admin</title>
       <link rel="stylesheet" href="external/ng-admin/build/ng-admin.min.css">
       <script src="external/ng-admin/build/ng-admin.min.js" type="text/javascript"></script>
       <script src="admin.js" type="text/javascript"></script>
   </head>

   <body ng-app="myApp"  ng-strict-di>
       <div ui-view="ng-admin"></div>
   </body>
</html>


// declare a new module called 'myApp', and make it require the `ng-admin`     module as a dependency
var myApp = angular.module('myApp', ['ng-admin']);

// declare a function to run when the module bootstraps (during the 'config' phase)
myApp.config(['NgAdminConfigurationProvider', function (nga) {

// create an admin application
var admin = nga.application('My First Admin')
    .baseApiUrl("http://vl-esifakis-ice:8000/tracker/");

var foundry = nga.entity('foundry');

foundry.listView().fields([                       
                           nga.field('name'),
                           nga.field('id')
                          ]);

admin.addEntity(foundry);
   // more configuration here later
   // ...
   // attach the admin application to the DOM and execute it
   nga.configure(admin);
}]);
4

1 回答 1

0

这是我制作的一个演示,

<!DOCTYPE html>
<html>
  <head>
    <link data-require="ng-admin@0.0.1" data-semver="0.0.1" rel="stylesheet" href="https://unpkg.com/ng-admin/build/ng-admin.min.css" />
    <link rel="stylesheet" href="style.css" />
    <script data-require="ng-admin@0.0.1" data-semver="0.0.1" src="https://unpkg.com/ng-admin/build/ng-admin.min.js"></script>
    <script data-require="angular-mocks@*" data-semver="1.3.5" src="https://code.angularjs.org/1.3.7/angular-mocks.js"></script>
    <script src="admin.js"></script>
    <!-- <script src="backend.js"></script>
    -->    
  </head>
  <body ng-app="myApp">
    <div ui-view="ng-admin"></div>
  </body>
</html>

演示

于 2017-01-28T05:13:42.127 回答