Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I have the following structure of files:

  • index.html

  • tpl/page.html

  • app.js

Description:

  1. app.js has definition of main module with routing to page.html

  2. index.html defines view for template and includes app.js

  3. page.html has definition of PageController inside tag and div who is using this controller.

Problem When PageController resides in page.html it doesn't work but when it is included into app.js then it works. Error is following: Argument 'PageController' is not aNaNunction, got undefined.

It looks like it is too late to define controller in template. But actually it is my requirement. I want to hide page.html + controller (even their code) from all users and make it visible only to particular group by Spring security. That is why I defined security constraint for this page and want it to be executed only when this constraints are met.

Update #1 Controller definition:

<script type="text/javascript">
  mainApp.controller('PageController', function($scope, $rootScope) {
    ...
  });
</script>

<md-content ng-controller="PageController" ...
share|improve this question
1  
Please show an example of how you are defining the controller in the template. – Andrew H 17 hours ago
    
Done. Controller definition added. – ICE 16 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.