angularjs ng-admin 0.9没有显示任何内容

时间:2017-01-28 03:16:19

标签: angularjs ng-admin

我正在尝试使用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);
}]);

1 个答案:

答案 0 :(得分: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>

<强> DEMO