0

i am trying to use ng-admin for the firs time. i am just following the example in and i am unable to see anything in the browser. my code is minimal, so not sure what i am doing wrong.

any ideas? did i not install correctly? i just downloaded it from a site and unzipped the file.

<!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);
}]);
  • do you see any errors in console? – Sajeetharan Jan 28 '17 at 04:22
  • @Sajeetharan no errors, just a blank page. it's like something isn't being loaded. when i reload the page, a blue line flashes across the top, but nothing is drawn on the page. – Emmanuel Sifakis Jan 28 '17 at 04:37
  • @Sajeetharan actually i am able to make progress now...had to clear the browser cache to see things work. – Emmanuel Sifakis Jan 30 '17 at 02:10
  • ok cool. mark as answer if it has helped – Sajeetharan Jan 30 '17 at 02:11
  • @Sajeetharan actually i am able to make progress now...had to clear the browser cache to see things work. a couple of question...what does this mean: data-require="ng-admin@0.0.1" data-semver="0.0.1"? why are those needed? in the help doc for ng-admin it says i should just be to install locally with the data-require or data-semver tags – Emmanuel Sifakis Jan 30 '17 at 02:16
  • Those are not needed actually – Sajeetharan Jan 30 '17 at 02:17
  • @Sajeetharan yes, i verified i can load without those. so i guess i am now back to the orig situation...why the load of my local ng-admin/build/ng-admin.min.css and ng-admin/build/ng-admin.min.js are not working. also, what does the angular-mocks.js file in your setup do? – Emmanuel Sifakis Jan 30 '17 at 02:49

1 Answers1

0

Here is a demo which i have made,

<!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

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396