How to separate the ionic folder structure

I started with all the js files in a js folder and all the html in an html folder.

I went ahead and created a homepage folder that has the homepage.html and homepage.js. After that I referenced the new js in the index.html and fixed the router issue. But its not working, and I get a module not available error.

here is my link in the index.html

  <script src="templates/homePage/homePage.js"></script>

here is my homepage.js

angular.module('app.controllers')

.controller('jobStoreCtrl', function($scope) {

})

here is my homepage.html

<ion-view title="JobStore" hide-nav-bar="true" id="page1" class=" ">
    <ion-content id="mainPage" padding="false" class="manual-ios-statusbar-padding">
        <div class="spacer" id="spacerMainPage"></div>
        <div class="">
            <a style="display:block;" href="#" onclick="window.open('/', '_system', 'location=yes'); return false;">
                <img id="logo" src="img/m51n5qOPRyC74l3i8v9E_blue_logo_small.png" width="40%" height="">
            </a>
        </div>
        <div class="spacer" id="spacerMainPage"></div>

        <div id="button-bar1" class=" button-bar ">
            <a ui-sref="signup" id="ignup" class=" button button-light  button-block ">Sign Up</a>
            <a ui-sref="login" id="signin" class=" button button-positive  button-block ">Sign In</a>
        </div>
    </ion-content>

and here is my the start of the route

 .state('jobStore', {
      url: '/homePage',
      templateUrl: 'templates/homePage/jobStore.html',
      controller: 'jobStoreCtrl'
  })

Are you loading app.controllers as a dependency in your main app module?

That solved it :slight_smile: thank you.

I have another issue now. In the controller I have a function called post and it’s giving me an error called ‘cannot set property ‘post’ of undefined’

Post code if you still have a problem.