CaryLandholt / ng-classify

Convert CoffeeScript classes to AngularJS modules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Router not being called.

ashmore11 opened this issue · comments

Hi There,

So I've been having trouble when trying to run my app after compilation.

At the moment I'm keeping all my coffee classes in separate files then using gulp to ngClassify() then concat all the files together which compiles to the following script:

var App;

App = (function() {
  function App() {
    return ['firebase', 'ngRoute'];
  }

  return App;

})();

angular.module('app', new App());

var Routes;

Routes = (function() {
  function Routes($locationProvider, $routeProvider) {
    $locationProvider.html5Mode(true);
    $routeProvider.when('/', {
      templateUrl: 'views/home.html',
      controller: 'homeController'
    }).when('/project/:id', {
      templateUrl: 'views/project.html',
      controller: 'projectController'
    }).otherwise({
      templateUrl: 'views/404.html'
    });
  }

  return Routes;

})();

angular.module('app').config(['$locationProvider', '$routeProvider', Routes]);

var Home;

Home = (function() {
  function Home($scope) {
    $scope.controller = this;
  }

  return Home;

})();

angular.module('app').controller('homeController', ['$scope', Home]);

var Project;

Project = (function() {
  function Project($scope, $routeParams, $firebaseObject) {
    var ref, url;
    $scope.controller = this;
    url = 'https://scorching-fire-8072.firebaseio.com/projects/' + $routeParams.id;
    ref = new Firebase(url);
    $scope.data = $firebaseObject(ref);
  }

  return Project;

})();

angular.module('app').controller('projectController', ['$scope', '$routeParams', '$firebaseObject', Project]);

This looks all good to me but maybe I'm missing something silly here?

Hope you can help!

Thanks,
Scott.

Ok i'm embarrassed now. I was bootstrapping angular from my app.coffee file before using ng-classify and after I switched I removed the bootstrap and forgot to add the ng-app directive... oops!

Glad you figured it out.