I have a Rails 4 application with AngularJS using these gems:
- gem 'angularjs-rails'
- gem 'angular -rails-templates'
- gem 'asset_sync'
It works fine with a template like this:
<img ng-controller='LikePostController'
ng-dblclick='like(post);'
ng-src='{{post.photo.standard}}'
class='lazy post_photo pt_animate_heart'
id='post_{{post.id}}_image'
/>
The image is displayed correctly. However in my other js
petto.directive('ptAnimateHeart', ['Helper', function(Helper){
linkFunc = function(scope, element, attributes) {
$heartIcon = $("#heart_icon");
if($heartIcon.length == 0) {
$heartIcon = $("<img id='heart_icon' src='/assets/feed.icon.heart.png' alt='Like' /> ");
$(document.body).append($heartIcon);
}
element.on('dblclick', function(event){
$animateObj = $(this);
Helper.animateHeart($animateObj);
});
}
return {
restrict: 'C',
link: linkFunc
}
}])
I got the "assets / feed.icon.heart.png" error not found from the browser console. I have feed.icon.heart.png located under app / assets / feed.icon.heart.png.
ps: Forget to mention that I use sync gem assets to place assets in amazon s3. The image worked well in development, but not in production.
source
share