crud-generator : Error 404 on view files - mean

So after installing the MeanJS stack, I used the crud module generator :
yo meanjs:crud-module posts
Everything worked fine but when I click a link in the new Post menu I got :
GET http://localhost:3000/modules/posts/client/views/list-posts.client.view.html 404 (Not Found)
The file do exists though, I checked the routes and stuffs but everything seems ok.
Thanks for the help.

In your posts.client.routes.js just change the templateUrl to 'modules/posts/views/form-program.client.view.html' from 'modules/posts/client/views/form-program.client.view.html'
It worked for me

Related

grails can't find view from plugin

I'm trying to write a grails plugin that can view files. Actually, I'm just trying to upgrade this one here... https://github.com/intelligrape/File-Viewer-Grails-Plugin to grails4, and get it working in my app.
Anyway, after I get it working in the app, I visit http://localhost:8080/file/index and I get this error:
URI
/file/index
Class
javax.servlet.ServletException
Message
Could not resolve view with name '/plugins/file-explorer-0.1/file/fileList' in servlet with name 'grailsDispatcherServlet'
This occurs when the controller does this...
def index(String filePath) {
Map model = [locations: fileLocations.locations]
// blah blah
render(view: "/file/fileList", model: model, plugin: 'fileExplorer')
}
The render() method is called (I checked in the debugger). I also tried removing the plugin: parameter, but it made no difference.
Now if I run the plugin as a standalone app (by going to that folder, and running "grails run-app", then it works as expected, and http://localhost:8080/file/index renders the view as one would expect.
This all leads me to believe that the plugin is basicly working and installed into my app EXCEPT the view component, which for whatever reason cannot find the views from a plugin.
If you want to know what the source looks like, it's basically what you see here:.. https://github.com/intelligrape/File-Viewer-Grails-Plugin Except I've renamed it from FileViewer to FileExplorer.
I'm using grails 4.1.0.M5 I don't know if it could be a bug in this version or what.
It seems that I should have had
plugin: 'filexplorer'
instead of
plugin: 'fileExplorer'
I could have sworn I tried this already. I guess the thing is it can be confusing which name to use where as far as plugins, as in the build.gradle name, the name in the *Plugin.groovy, the name in settings.gradle, the package name etc. Anyway, somehow I screwed up.

ngAnimate in Rails, I just want to hook it up

why is it always so hard to hook things up to AngularJS?!?!?!
here's the error I get for anything new I try to install to Angularjs:
Error: [$injector:unpr] http://errors.angularjs.org/1.2.8/$injector/unpr?p0=%24%24asyncCallbackProvider%20%3C-%20%24%24asyncCallback%20%3C-%20%24animate%20%3C-%20%24compile
Everything works fine when I don't include ngAnimate in:
WriterSarah = angular.module("WriterSarah", ["restangular", "ui.router", "ngAnimate" ])
I put my angular-animate.min.js file in the SAME place that I do all my other Angularjs files, and I required it in my Application.js file in the SAME way that I did for restangular and ui.router
I restarted my server a bunch of times as well. what am I missing here?
The problem is likely that the Angular version does not match to the angular-animate version. Check to see if the angular versions are the same between both files.

How to set path for a system call from inside a Rails app?

I am trying to execute phantom.js module from rails. So far I've successfully installed the binary and the path for phantomjs seems to be working fine.
However when I try to run it from a rails app using backtick (for example: phantomjs rasterize.js http://google.com 1.jpg), it says No such file or directory.
I think the reason is it can't find the path for rasterize.js
I tried putting the rasterize.js file in #{Rails.root}, inside public folder, inside controller folder but nothing works.
How can I solve this problem?
====
UPDATE: To clarify, i'm posting which code works inside my controller and which doesn't.
def create
'phantomjs'
end
<= Above code doesn't spit out path error, and when I send a request from the browser, phantomjs process does get invoked, resulting in opening up the console in the server side.
def create
'phantomjs rasterize.js'
end
<= This doesn't work, and it spits out error saying "No such file or directory", and that's why I think it has to do with rails not being able to find rasterize.js's path. I tried putting rasterize.js inside public folder, inside controllers folder, and inside the main directory: #{Rails.root}, but it's always the same.
Interesting... I've been trying all kinds of combinations and finally ran into a case that works, and it's not what I expected:
%x("/usr/local/bin/phantomjs /Users/e/Dropbox/Projects/rails/screenshots/rasterize.js http://google.com app/assets/images/2709.jpg")
<= This doesn't work.
system("/usr/local/bin/phantomjs /Users/e/Dropbox/Projects/rails/screenshots/rasterize.js http://google.com app/assets/images/2709.jpg")
<= This works.
I thought these all work internally the same, except for return values? Maybe I was wrong?
Let say your command is cmd.It is good to know that %(cmd) and exec(cmd), change the process you are on so if you are in rails and changed the directory it will exit. On the other hand `cmd` and system(cmd) will let you continute working.
I learned that from this blog. http://blog.jayfields.com/2006/06/ruby-kernel-system-exec-and-x.html

No Route matches "say/hello" when route exists

I'm trying to create a very simple Hello, world program in RoR, but when I go to view the url http://localhost:3000/say/hello I'm getting the error message No route matches: "say/hello"
I started with: rails generate controller Say hello goodbye
which lists route get "say/hello"
Also: I'm having this problem which is probably related. When I go to write some basic html in one of the files that is clearly listed as existing I get this:
I write this:
~/work/demo$ /app/views/say/hello.html.erb
Get this error message in return:
bash: /app/views/say/hello.html.erb: No such file or directory
What's going on here? I'm getting these instructions straight from Agile Development with Rails and it's so simple.
With the details you've given I'm not sure why your route can't be found.
However, I believe the reason you're experiencing the no such file or directory error is because you're typing /app/views/say/hello.html.erb. Try removing the leading slash, so that it reads app/views/say/hello.html.erb. Bash appears to be parsing the former path as an absolute path, instead of a path relative to your current working directory.
What is this command?
~/work/demo$ /app/views/say/hello.html.erb
you should be using your web browser: http://localhost:3000/say/hello

cakephp Router::parseExtensions('ics') doesn't work properly

I'm trying to create an ical-file.
So I set Router::parseExtensions('ics') in router.php.
I created a folder ics in app/views/layouts and a default.ctp with this content
<?php
header('Content-Type: text/calendar');
echo $content_for_layout;
?>
In my reservationsController I created a ical() action and created a ical.ctp in /app/views/reservations/ics/.
So, if I'm trying to access http://localhost/reservations/ical/1.ics I get an error:
Error: The view for ReservationsController::ical() was not found.
Error: Confirm you have created the file: C:\xampp\htdocs\ers\app\views\reservations\ical.ctp
So I'm a bit confused about the error-message. Why does it search the ical.ctp in app\views\reservations\ and not in app\views\reservations\ics\?
When I'm using another extension like .xml the error message looks like this:
Error: Confirm you have created the file: C:\xampp\htdocs\ers\app\views\reservations\xml\ical.ctp
Why does xml work and ics don't? What went wrong?
I've just finished dealing with this situation myself. I'd been trying to get a csv extension to display, and I was also getting the "missing view" error.
Everything was in place; I had my /app/views/layouts/csv/default.ctp and /app/views/users/csv/export.ctp view files set up. I had Router::parseExtensions('csv'); at the top of my /app/config/routes.php file.
Turns out, what I had forgotten was to add the RequestHandler component to my controller's components array: var $components = array('RequestHandler');.
Once I did that everything worked perfectly.
So if you've stumbled upon this question because you're having the same issue, check to be sure you're loading the RequestHandler component fixes things for you...
I just had the same trouble creating the ics example # http://www.dereuromark.de/2011/11/21/serving-views-as-files-in-cake2
Needed quite a while to figur out that this seems to be a cake bug and opend a ticket for it :)
http://cakephp.lighthouseapp.com/projects/42648-cakephp/tickets/2565-cakeresponse-is-missing-icalendar-and-not-responding-as-documented
Hopefully this will be resolved soon.
PS: I also posted a workaround / quickfix for this until it is fixed in the core.

Resources