jasonswett / angular-for-rails-developers-issues Goto Github PK
View Code? Open in Web Editor NEWIssues found in Angular for Rails Developers book
Home Page: https://www.angularonrails.com/angular-rails-developers/
Issues found in Angular for Rails Developers book
Home Page: https://www.angularonrails.com/angular-rails-developers/
ng serve
It seems like you're using a project generated using an old version of the Angular CLI.
The latest CLI now uses webpack and includes a lot of improvements, include a simpler
workflow, a faster build and smaller bundles.To get more info, including a step-by-step guide to upgrade the CLI, follow this link:
https://github.com/angular/angular-cli/wiki/Upgrading-from-Beta.10-to-Beta.12_**
Switching to webpack seems like a big change. Is this something that will cause headaches later on, when version 1.0.0 of the CLI is completed? Has anyone tried the upgrade instructions on the author_wizard app? Do they work?
I must say its been really turbulent since i started following. Im running windows 8 on macbook pro. Right now i am stuck in page 8 git push heroku master. I get the error : failed to detect set buildpack https://github.com/jasonswett/heroku-buildpack-nodejs.
I feel that i must equally mention what i have experienced before i got here
A combined diff like view where the additions are picked out in, for example, green, would be especially helpful on pages 20 (spec/rails_helper.rb
) and 22, and 23.
We’re told about the http://localhost:3000/api/books.json URL on page 25, Adding some seed data, and to spin up the Rails server and check out the URL, but, we haven’t added the api
route to routes.rb
yet.
Happily, http://localhost:3000/books.json works without any modification.
Page 26 has another mention of this URL when we’ve uploaded to Heroku (Heroku prints out a JSON formatted error, nice).
It would be a lot easier to follow the longer code blocks if block folding were illustrated somehow.
I had a slight issue with the reference code for spec/controllers/book_controller_spec.rb
, with it spanning three pages, and with the multiple edits required, I deleted an end
and took some time to find where it was missing.
Line numbers would be nice too, something like this:
If not block folding, how about showing tabs or spaces:
I can’t get the integration test introduced in Adding Integration Tests to work without modification.
This is the error message reported:
Failures:
1) Books list page
Failure/Error: raise ActionController::RoutingError, "No route matches [#{env[ 'REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}"
ActionController::RoutingError:
No route matches [GET] "/ember-cli-live-reload.js"
[…]
# --- Caused by: ---
# Capybara::ExpectationNotMet:
# expected to find text "Books" in "Loading..."
[…]
Before:
# spec/features/books_spec.rb
require 'rails_helper'
feature 'Books', js: true do
scenario 'list page' do
visit '/'
expect(page).to have_content('Books')
end
end
And here’s the spec after I modified it:
require 'rails_helper'
Capybara.raise_server_errors = false
feature 'Book', js: true do
scenario 'list page' do
visit '/'
sleep 5.second # !important
expect(page).to have_content('Book')
end
end
If I leave out the Capybara.raise_server_errors = false
, then the RoutingErrors still appear. If I leave out the sleep 5.second
, then the browser window pops open and closes before the page has loaded.
I’ve finished the book, committed the change locally and ran git remote show heroku
, but the Heroku application isn’t up to date. Any ideas why?
I’ve tried rebooting the app (through the Heroku web dashboard, Overview → More → Restart all dynos) and heroku ps:restart
.
The Heroku repository reports it’s up to date:
# git remote show heroku
* remote heroku
Fetch URL: https://git.heroku.com/secure-depths-61266.git
Push URL: https://git.heroku.com/secure-depths-61266.git
HEAD branch: master
Remote branch:
master tracked
Local ref configured for 'git push':
master pushes to master (up to date)
And:
# git ls-remote heroku
11ac8180b8748fbd4f50e955c791f209eaa74400 HEAD
11ac8180b8748fbd4f50e955c791f209eaa74400 refs/heads/master
And the Heroku app: https://secure-depths-61266.herokuapp.com
And I check back a few hours later and it’s up-to-date with my local git repository. Any idea why there would be a lag between push and updating? Is there some kind of caching going on? (I really should have tried in a different browser, this was all observed using Google Chrome.)
I've worked through errors in the heroku deployment, but now Im not sure what the issue is.
http://stackoverflow.com/questions/40208635/angular-for-rails-developers-book-deploying-angular-on-rails-on-heroku
Push rejected, failed to compile Node.js app.
https://github.com/theresaluu/tut-angular-for-rails-developers
I previously had an issue with my package.json because it was missing a comma, but I addressed that . Any help would be appreciated.
In the Fixing the test suite section, we remove the describe "GET #edit" do
block, but the following full code output of spec/controllers/book_controller_spec.rb
on pages 14 and 15 still includes the block.
This is meaningful because when Angular CLI serves our Angular app locally, the way it does that is by running the ng build command which generates a dist directory. Inside that dist directory is everything that's needed to run our Angular app, including an index.html which, if visited, will kick off everything else that's needed to pull up the app.
Should be
This is meaningful because when Angular CLI serves our Angular app locally, the way it does that is by running the ng build command which generates a src directory. Inside that src directory is everything that's needed to run our Angular app, including an index.html which, if visited, will kick off everything else that's needed to pull up the app.
Firefox has a problem with correctly receiving the JSON formatted data, the issue is caused by the request headers that it sends along. The default:
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
Google Chrome by contrast sends this request header, which accepts anything:
Accept: */*
So, if you’re using Firefox, when you get to this point in the book, where the list of books is expected, nothing appears. Nothing appears because ng server
has sent back the main index.html
instead of the desired JSON in response, viewing Firefox’s developer tools console shows this error:
EXCEPTION: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
(The first and unexpected character is the first character <
.)
One way to fix this is to change the Header sent with the http.get
.
Before:
// src/app/book-list/book-list.component.ts
[…]
import { Http } from '@angular/http';
[…]
ngOnInit() {
this.http.get('/api/books.json')
.subscribe((response) => this.books = response.json());
}
[…]
After:
// src/app/book-list/book-list.component.ts
[…]
import { Http, Headers } from '@angular/http';
[…]
ngOnInit() {
this.http.get('/api/books.json', { headers: new Headers({'Accept' : '*/*' }) })
.subscribe((response) => this.books = response.json());
}
[…]
Maybe there’s a better way? Maybe this will be fixed in Angular?
Source: angular/angular-cli#889
"start": "ng serve" is instructed to be removed in package.json but is still included in the code sample
The free Getting Started with Angular and Rails, in the section named Step 2: Add an HTTP request to Angular, contains the following code:
this.http.get('/api/books.json')
I believe it should be:
this.http.get('//localhost:3000/api/books.json')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.