2

I am working on a django project that relies on angularjs and having trouble implementing angular-ui-router framework.

As mentioned in documentation I have included ui.router as a dependency,

app = angular.module('myApp',['restangular','ui.router',])

configured the states as follows,

app.config(['$stateProvider',function($stateProvider){
    $stateProvider.state('landing',{
      url: '/',
      template:"<p> somethings here.</p>"
    })
  }]);

in base.html file i bootstrap the django project with angularjs as required ng-app=myApp.

and in index.html which inherits base.html

<div ui-view>
  <i>nothing here but this text</i>
</div>

my urls.py,

url(r'^$',home,name="homepage")

This does not work, ui-router never includes the inline template in index.html. index.html always loads nothing here but this text. I have looked at as much questions asked here but are not helping. What am I missing, is this specific to django?

1 Answer 1

1

I would say that these lines should make it:

app.config(['$urlRouterProvider',function($urlRouterProvider){
    $urlRouterProvider.otherwise('/');
  }]);

Check the working plunker here

Also check:

Sign up to request clarification or add additional context in comments.

1 Comment

Great, enjoy awesome ui-router :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.