Skip to content

Commit

Permalink
change the way angular module is defined (fixes #8)
Browse files Browse the repository at this point in the history
  • Loading branch information
pitr committed Oct 29, 2013
1 parent d683055 commit 093e2dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion app/assets/javascripts/angular-rails-templates.js.erb
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
angular.module(<%= Rails.configuration.angular_templates.module_name.inspect %> , window.AngularRailsTemplates);
10 changes: 4 additions & 6 deletions lib/angular-rails-templates/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ def evaluate(scope, locals, &block)
logical_template_path = logical_template_path(scope)

<<-EOS
angular.module(#{module_name.inspect}, []).run(["$templateCache",function($templateCache) {
window.AngularRailsTemplates || (window.AngularRailsTemplates = angular.module(#{module_name.inspect}, []));
window.AngularRailsTemplates.run(["$templateCache",function($templateCache) {
$templateCache.put(#{logical_template_path.inspect}, #{data.to_json});
}]);
if (typeof window.AngularRailsTemplates === 'undefined') {
window.AngularRailsTemplates = [];
}
window.AngularRailsTemplates.push(#{module_name.inspect});
EOS
end

Expand Down

3 comments on commit 093e2dc

@pitr
Copy link
Owner Author

@pitr pitr commented on 093e2dc Oct 30, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My module can't find module 'templates' after this commit.

@l33tas sorry, I just deleted my fork. This is the official repo.

@pitr
Copy link
Owner Author

@pitr pitr commented on 093e2dc Oct 30, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you create an issue?

@mkazlauskas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Please sign in to comment.