Creating a static page in ng-admin without backend requests

Adding a non-dynamic view to ng-admin

I’m working on an ng-admin project and I need to include a page that doesn’t fetch data from the server. Think of it as a simple ‘About Us’ section or a static info page.

Is there a way to set this up in ng-admin? I’ve looked through the docs but couldn’t find anything specific about creating views that don’t need backend calls.

Has anyone done this before? What’s the best approach to add a completely static view in an ng-admin app? Any tips or code examples would be super helpful!

// Example of what I'm trying to achieve
app.addEntity(nga.entity('staticPage')
    .label('About Us')
    .readOnly()
    .showView(nga.view().template(`
        <h1>About Our Company</h1>
        <p>We are awesome! No backend call needed.</p>
    `))
);

Is something like this possible? Or is there a better way to handle static content in ng-admin? Thanks in advance for any help!

ooh, interesting question! have u considered using a custom directive for this? it might give u more flexibility. something like:

app.directive('staticPage', function() {
  return {
    restrict: 'E',
    template: '<div>ur static content here</div>'
  };
});

then u could use it in ur view. what do u think? would that work for ur needs?

While the previous answer is correct, there is an alternative approach that might suit more complex needs. Instead of relying solely on the .template() method, you can create a custom page by leveraging ng-admin’s ability to integrate AngularJS components. This involves defining a new state in your app’s routing configuration, establishing a dedicated AngularJS controller for the page, and crafting a specific template for your static content. Additionally, you can add a menu item in ng-admin to navigate to this custom page, offering greater flexibility in layout and functionality.

hey, i’ve done this before! you can use the .template() method on the view to add static content. something like:

app.addEntity(nga.entity('static')
  .label('About')
  .readOnly()
  .showView(nga.view().template('<h1>About Us</h1><p>Your content here</p>'))
);

this should work for wat you need. good luck!