Code Monkey home page Code Monkey logo

angular-seed's Introduction

angular-seed — the seed for AngularJS apps

This project is an application skeleton for a typical AngularJS web app. You can use it to quickly bootstrap your angular webapp projects and dev environment for these projects.

The seed contains a sample AngularJS application and is preconfigured to install the AngularJS framework and a bunch of development and testing tools for instant web development gratification.

The seed app doesn't do much, just shows how to wire two controllers and views together.

Getting Started

To get you started you can simply clone the angular-seed repository and install the dependencies:

Prerequisites

You need git to clone the angular-seed repository. You can get git from here.

We also use a number of Node.js tools to initialize and test angular-seed. You must have Node.js and its package manager (npm) installed. You can get them from here.

Clone angular-seed

Clone the angular-seed repository using git:

git clone https://github.com/angular/angular-seed.git
cd angular-seed

If you just want to start a new project without the angular-seed commit history then you can do:

git clone --depth=1 https://github.com/angular/angular-seed.git <your-project-name>

The depth=1 tells git to only pull down one commit worth of historical data.

Install Dependencies

We have two kinds of dependencies in this project: tools and AngularJS framework code. The tools help us manage and test the application.

We have preconfigured npm to automatically copy the downloaded AngularJS files to app/lib so we can simply do:

npm install

Behind the scenes this will also call npm run copy-libs, which copies the AngularJS files and other front end dependencies. After that, you should find out that you have two new directories in your project.

  • node_modules - contains the npm packages for the tools we need
  • app/lib - contains the AngularJS framework files and other front end dependencies

Note copying the AngularJS files from node_modules to app/lib makes it easier to serve the files by a web server.

Run the Application

We have preconfigured the project with a simple development web server. The simplest way to start this server is:

npm start

Now browse to the app at localhost:8000/index.html.

Directory Layout

app/                  --> all of the source files for the application
  app.css               --> default stylesheet
  core/                 --> all app specific modules
    version/              --> version related components
      version.js                 --> version module declaration and basic "version" value service
      version_test.js            --> "version" value service tests
      version-directive.js       --> custom directive that returns the current app version
      version-directive_test.js  --> version directive tests
      interpolate-filter.js      --> custom interpolation filter
      interpolate-filter_test.js --> interpolate filter tests
  view1/                --> the view1 view template and logic
    view1.html            --> the partial template
    view1.js              --> the controller logic
    view1_test.js         --> tests of the controller
  view2/                --> the view2 view template and logic
    view2.html            --> the partial template
    view2.js              --> the controller logic
    view2_test.js         --> tests of the controller
  app.js                --> main application module
  index.html            --> app layout file (the main html template file of the app)
  index-async.html      --> just like index.html, but loads js files asynchronously
e2e-tests/            --> end-to-end tests
  protractor-conf.js    --> Protractor config file
  scenarios.js          --> end-to-end scenarios to be run by Protractor
karma.conf.js         --> config file for running unit tests with Karma
package.json          --> Node.js specific metadata, including development tools dependencies
package-lock.json     --> Npm specific metadata, including versions of installed development tools dependencies

Testing

There are two kinds of tests in the angular-seed application: Unit tests and end-to-end tests.

Running Unit Tests

The angular-seed app comes preconfigured with unit tests. These are written in Jasmine, which we run with the Karma test runner. We provide a Karma configuration file to run them.

  • The configuration is found at karma.conf.js.
  • The unit tests are found next to the code they are testing and have a .spec.js suffix (e.g. view1.spec.js).

The easiest way to run the unit tests is to use the supplied npm script:

npm test

This script will start the Karma test runner to execute the unit tests. Moreover, Karma will start watching the source and test files for changes and then re-run the tests whenever any of them changes. This is the recommended strategy; if your unit tests are being run every time you save a file then you receive instant feedback on any changes that break the expected code functionality.

You can also ask Karma to do a single run of the tests and then exit. This is useful if you want to check that a particular version of the code is operating as expected. The project contains a predefined script to do this:

npm run test-single-run

Running End-to-End Tests

The angular-seed app comes with end-to-end tests, again written in Jasmine. These tests are run with the Protractor End-to-End test runner. It uses native events and has special features for AngularJS applications.

  • The configuration is found at e2e-tests/protractor-conf.js.
  • The end-to-end tests are found in e2e-tests/scenarios.js.

Protractor simulates interaction with our web app and verifies that the application responds correctly. Therefore, our web server needs to be serving up the application, so that Protractor can interact with it.

Before starting Protractor, open a separate terminal window and run:

npm start

In addition, since Protractor is built upon WebDriver, we need to ensure that it is installed and up-to-date. The angular-seed project is configured to do this automatically before running the end-to-end tests, so you don't need to worry about it. If you want to manually update the WebDriver, you can run:

npm run update-webdriver

Once you have ensured that the development web server hosting our application is up and running, you can run the end-to-end tests using the supplied npm script:

npm run protractor

This script will execute the end-to-end tests against the application being hosted on the development server.

Note: Under the hood, Protractor uses the Selenium Standalone Server, which in turn requires the Java Development Kit (JDK) to be installed on your local machine. Check this by running java -version from the command line.

If JDK is not already installed, you can download it here.

Updating AngularJS and other dependencies

Since the AngularJS framework library code and tools are acquired through package managers (e.g. npm) you can use these tools to easily update the dependencies. Simply run the preconfigured script:

npm run update-deps

This will call npm update and npm run copy-libs, which in turn will find and install the latest versions that match the version ranges specified in the package.json file.

If you want to update a dependency to a version newer than what the specificed range would permit, you can change the version range in package.json and then run npm run update-deps as usual.

Loading AngularJS Asynchronously

The angular-seed project supports loading the framework and application scripts asynchronously. The special index-async.html is designed to support this style of loading. For it to work you must inject a piece of AngularJS JavaScript into the HTML page. The project has a predefined script to help do this:

npm run update-index-async

This will copy the contents of the angular-loader.js library file into the index-async.html page. You can run this every time you update the version of AngularJS that you are using.

Serving the Application Files

While AngularJS is client-side-only technology and it is possible to create AngularJS web apps that do not require a backend server at all, we recommend serving the project files using a local web server during development to avoid issues with security restrictions (sandbox) in browsers. The sandbox implementation varies between browsers, but quite often prevents things like cookies, XHR, etc to function properly when an HTML page is opened via the file:// scheme instead of http://.

Running the App during Development

The angular-seed project comes preconfigured with a local development web server. It is a Node.js tool called http-server. You can start this web server with npm start, but you may choose to install the tool globally:

sudo npm install -g http-server

Then you can start your own development web server to serve static files from any folder by running:

http-server -a localhost -p 8000

Alternatively, you can choose to configure your own web server, such as Apache or Nginx. Just configure your server to serve the files under the app/ directory.

Running the App in Production

This really depends on how complex your app is and the overall infrastructure of your system, but the general rule is that all you need in production are the files under the app/ directory. Everything else should be omitted.

AngularJS apps are really just a bunch of static HTML, CSS and JavaScript files that need to be hosted somewhere they can be accessed by browsers.

If your AngularJS app is talking to the backend server via XHR or other means, you need to figure out what is the best way to host the static files to comply with the same origin policy if applicable. Usually this is done by hosting the files by the backend server or through reverse-proxying the backend server(s) and web server(s).

Continuous Integration

Travis CI

Travis CI is a continuous integration service, which can monitor GitHub for new commits to your repository and execute scripts such as building the app or running tests. The angular-seed project contains a Travis configuration file, .travis.yml, which will cause Travis to run your tests when you push to GitHub.

You will need to enable the integration between Travis and GitHub. See the Travis website for instructions on how to do this.

Contact

For more information on AngularJS please check out angularjs.org.

angular-seed's People

Contributors

btford avatar elnur avatar ermakovich avatar fuentesjr avatar gkalpak avatar igorminar avatar iszak avatar jeffbcross avatar jksdua avatar joewhite avatar juliemr avatar khobalt avatar marcenuc avatar mhevery avatar michaelneale avatar mikaelharsjo avatar ngdashboard avatar pedrosanta avatar petebacondarwin avatar philspitler avatar reemaind avatar richguan avatar rolaveric avatar saiqulhaq avatar scottsword avatar segeda avatar spooky avatar tbosch avatar termosa avatar vojtajina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-seed's Issues

ngResource is out of date

Angular master has a far superior version of ngResource. Seed's current ngResource does not support custom HTTP Headers. 😢

get "Invalid config file" error running e2e test

I run testacular testacular-e2e.conf.js in /config and get following error:

error (config): Invalid config file!
 [ReferenceError: ANGULAR_SCENARIO is not defined]

and running testacular start testacular-e2e.conf.js will get config file does not exists error.

by the way, my version is 0.0.17

404 Errors

I get 404 errors when I try to go to localhost:8000/app/index.html. I wonder what the matter might be in this case.

Version 1.2.10 Line 14153 Perforce check-in error

When checking in angular.js on line 14153 the double quotes:

@returns {string} Number rounded to decimalPlaces and places a “,” after each third digit.

Causes errors in Perforce:

01e19280 12:50:20.021 [0x41a4d60][2204040e] Translation of file content failed near line 14153 file ...\www\Scripts\angular.js
01e19280 12:50:20.936 [0x41a4d60][30221c33] Submit aborted -- fix problems then use 'p4 submit -c 2323'.

Taking away the funky double-quotes and replacing with standard allows for check-in.

e2e Test : function inject not defined

Hello,

I've got a problem try to make my first e2e test using angular-seed bundle :
when I try to run the e2e-test.sh with this simple scenario :
http://jsfiddle.net/KaiPierre/vGFFm/

response is :
Uncaught ReferenceError: inject is not defined
at /path/assets/test/e2e/scenarios.js:9

I don't understand where is the bug, it seem my runner don't understand simple script command

Conf files attributes are the same as seed bundle :
files = [
ANGULAR_SCENARIO,
ANGULAR_SCENARIO_ADAPTER,
'test/e2e/*/.js'
];

Any one have an idea ?

Transparent logo

@angelalam can you export a copy of the logo, white on transparent background (just the icon)? ~34px tall with no margin (can be wider).

Do not make separate namespaces for controllers and services, etc

It does not make sense to make separate namespaces for controllers and services within one app.

People like Miško Hevery (who started Angular) and John Lindquist (egghead.io) say this.

I assume it is self-evident to you, too; but it is confusing for beginners that the seed suggests they do the opposite of what the experts are actually saying.

Angular Loader.js needs to be updated

I came across a really strange issue where using the $script.js to asynchronously load files was causing some rather in-explainable errors.

I finally figured out that the issue was related to using $script.js to directly load angular.js with the app (as shown in the expample). When using a normal <script> tag to load angular it worked fine. However, the reason this is not working is because the angular loader.js file that is included inline in the angular-seed app on the index-async.html page is out of date.

For those of you who come across this problem, the easiest way to solve it is to grab the loader.js directly from the angularjs github, but you'll also need to grab the prefix and suffix to include at the beginning and end of the loader.js file.

Adding jquery

Adding

<script src="lib/jquery/jquery-1.10.2.min.js"></script>

to

        <script src="lib/angular/angular.js"></script>

cause:

SyntaxError: syntax error
<!doctype html>

1.2.x branch?

I'm starting out with Angular and would like to jump straight into 1.2. Starting a 1.2.x branch would be beneficial to assist adoption.

Dropping in Angular 1.2 rc2 into the seed project throws the following error:

Error: [$injector:modulerr] Failed to instantiate module myApp due to:
[$injector:unpr] Unknown provider: $routeProvider
http://errors.angularjs.org/1.2.0-rc.2/$injector/unpr?p0=%24routeProvider
minErr/<@http://localhost:8000/app/lib/angular/angular.js:78
createInjector/providerCache.$injector<@http://localhost:8000/app/lib/angular/angular.js:2997
getService@http://localhost:8000/app/lib/angular/angular.js:3119
invoke@http://localhost:8000/app/lib/angular/angular.js:3140
createInjector/loadModules/<@http://localhost:8000/app/lib/angular/angular.js:3078
forEach@http://localhost:8000/app/lib/angular/angular.js:224
loadModules@http://localhost:8000/app/lib/angular/angular.js:3065
createInjector@http://localhost:8000/app/lib/angular/angular.js:3007
bootstrap/doBootstrap@http://localhost:8000/app/lib/angular/angular.js:1152
bootstrap@http://localhost:8000/app/lib/angular/angular.js:1168
angularInit@http://localhost:8000/app/lib/angular/angular.js:1119
@http://localhost:8000/app/lib/angular/angular.js:18016
trigger@http://localhost:8000/app/lib/angular/angular.js:2021
createEventHandler/eventHandler/<@http://localhost:8000/app/lib/angular/angular.js:2277
forEach@http://localhost:8000/app/lib/angular/angular.js:224
createEventHandler/eventHandler@http://localhost:8000/app/lib/angular/angular.js:2276

http://errors.angularjs.org/1.2.0-rc.2/$injector/modulerr?p0=myApp&p1=%5B%24injector%3Aunpr%5D%20Unknown%20provider%3A%20%24routeProvider%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.2.0-rc.2%2F%24injector%2Funpr%3Fp0%3D%2524routeProvider%0AminErr%2F%3C%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A78%0AcreateInjector%2FproviderCache.%24injector%3C%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A2997%0AgetService%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A3119%0Ainvoke%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A3140%0AcreateInjector%2FloadModules%2F%3C%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A3078%0AforEach%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A224%0AloadModules%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A3065%0AcreateInjector%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A3007%0Abootstrap%2FdoBootstrap%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A1152%0Abootstrap%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A1168%0AangularInit%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A1119%0A%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A18016%0Atrigger%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A2021%0AcreateEventHandler%2FeventHandler%2F%3C%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A2277%0AforEach%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A224%0AcreateEventHandler%2FeventHandler%40http%3A%2F%2Flocalhost%3A8000%2Fapp%2Flib%2Fangular%2Fangular.js%3A2276%0A
http://localhost:8000/app/lib/angular/angular.js
Line 78

I fail to see the difference in the new docs as well.

Incorrect reference to karma command in test.sh

When I run the following command, karma is not initialised:

$BASE_DIR/../node_modules/karma/bin/karma start $BASE_DIR/../config/karma.conf.js $*

However, if you remove the first part, it works.
karma start $BASE_DIR/../config/karma.conf.js $*

No licence for angular-seed

Hi,

What is the licence of angular-seed? There's a LICENCE file in the angular.js project, but not this one.

Cheers,
Alex

"Uncaught ReferenceError: minErr is not defined" running scripts/test.bat

If I clone the latest angular-seed (3fb3966), run npm install, and then run scripts\test.bat, I get the following output:

INFO [karma]: Karma v0.10.2 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 30.0.1599 (Windows 8)]: Connected on socket -TJSfJA1z5LbpRgfLTn-
Chrome 30.0.1599 (Windows 8) ERROR
        Uncaught ReferenceError: minErr is not defined
        at C:/dev/temp/angular-seed/app/lib/angular/angular-loader.js:19
Chrome 30.0.1599 (Windows 8) ERROR
        Uncaught ReferenceError: minErr is not defined
        at C:/dev/temp/angular-seed/app/lib/angular/angular-loader.min.js:6
Chrome 30.0.1599 (Windows 8): Executed 0 of 0 ERROR (0.272 secs / 0 secs)

So it gives this "minErr is not defined" error, and doesn't run any tests.

I'm using the latest Karma (0.10.2) on Windows 8.

If I clone and then immediately reset to the previous revision (3fb3966) and then npm install, then I can run the tests without errors. So it looks like this bug was introduced when angular-seed was updated to use Angular 1.2.0-rc3. I'm not sure whether it's an Angular bug or a problem with the way angular-seed is configured.

$http.get not returning local json

Hi everyone, i'm starting with this seed just now.
For a test, the attempt was getting locally saved json (at the root folder /phones.json)

It always returns my whole DOM as response.
I'm assuming it's because my $http.get url is not correct.
In my controller:

$http.get('http://localhost:3000/phones.json')
  .then(function(data) {
    console.log(data);
    $scope.phones = data;
  });

The url param is trying to get some page, right ? But i need to get my json file.
I would like to know where should i put my local json and how should i mention it on url param for $http.get.

Thanks, if u could help me, i appreciate!

index-async.

How would the index-async work with third party vendor javascripts? Can anyone show an example of loading modernizr, jquery and angular-ui? And also angular-resource, angular-sanitize?

I just tried it and it seems to give errors about things not being loaded.

Internet Explorer Compatibility Issues

The latest version of angular seed does not seem to work with Internet Explorer 7 for the regular synchronous index.html and both ie7 and ie 8 for the async version index-async.html.

The last working commit for the async version for these browsers is "add inlined ng:cloak definition to the async template" from Jan 23. It seems the synchronous version is broken in that commit.

The last working version for the syncrhronous mode index is "upgrade to AngularJS 0.10.0 chicken-hands"

I have conducted tests in IETester and the IE 9 compatibility mode for ie 7 not the genuine article.

How to use Bower to manage dependency in angular-seed?

Hi all, I want to use Bower to manage dependency of my project, how can I do that?
e.g. I want to use angular-bootstrap to build the UI. I run bower install angular-bootstrap, this package depends on angular, but Bower doesn't recognize I have one at app/lib/angular, it downloads another one to the bower_components folder.
How can I do to let Bower manage angular and other package together?

maintain a branch tracking latest unstable release of angular?

I started a project using angular-seed months and months ago, and have been happily pulling updates from it when it's updated to include a new version of angular. The latest release of Angular (1.0.5/1.1.3) includes features in the unstable version I'd like to use. Can angular-seed maintain a parallel branch including the latest unstable Angular release so users wishing to try it could pull from that branch instead of master, or is there another recommended way to do this?

How to use this seed with require.js?

Hi @IgorMinar
Require.js seems to be popular for AMD support, I am just wondering how can I use angular.js with Require.js. Is this seed project has ideas on how to use both fo them together?

Thanks

index-async.html works inconsistently with AngularJS 1.2 RC2

Loading dependencies asynchronously with AngularJS 1.2 RC 2 behaves inconsistently. If a failure occurs, a developer will see the following in the console window:

Uncaught Error: [$injector:modulerr] Failed to instantiate module mApp due to:
TypeError: undefined is not a function
at $RouteProvider.when (http://localhost:81/res/js/angular-route-1.2.0-rc.2.js:150:20)
at http://localhost:81/res/js/app.js:8:10
at Object.invoke (http://localhost:81/res/js/angular-1.2.0-rc.2.js:3153:25)
at http://localhost:81/res/js/angular-1.2.0-rc.2.js:3078:37
at Array.forEach (native)
at forEach (http://localhost:81/res/js/angular-1.2.0-rc.2.js:224:11)
at loadModules (http://localhost:81/res/js/angular-1.2.0-rc.2.js:3065:5)
at createInjector (http://localhost:81/res/js/angular-1.2.0-rc.2.js:3007:11)
at doBootstrap (http://localhost:81/res/js/angular-1.2.0-rc.2.js:1152:20)
at Object.bootstrap (http://localhost:81/res/js/angular-1.2.0-rc.2.js:1168:12)
http://errors.angularjs.org/1.2.0-rc.2/$injector/modulerr?p0=myApp&p1=Type…http%3A%2F%2Flocalhost%3A81%2Fres%2Fjs%2Fangular-1.2.0-rc.2.js%3A1168%3A12)

With the router moved to a module, this causes concerns related to application reliability.

E2E tests not run in index-async.html

I want to use async scripts loading, something like index-async.html.
But E2E tests do not start. I try start it manually and also via testacular.

Project is dead?

Is this project dead? There hasn't been a commit in two months but have been numerous issues and pull requests filed.

ui-router not working on angular-seed async version

loaded the library and created a main module

var myApp= angular.module('myApp', ['ui.state']);

Error:

Uncaught TypeError: undefined is not a function from ui.state

The error is coming from here:

function inherit(parent, extra) {
return extend(new (extend(function() {}, { prototype: parent }))(), extra);
Uncaught TypeError: undefined is not a function from ui.state
}

Cannot inject $scopt to controller

When I play with the code, I tried to put some data in $scope and render it on view.
However I cannot inject $scope into MyCtrl1 until I removed the [] which wrapped function.

  controller('MyCtrl1', [function($scope, $routeParams) {
    $scope.mydata = 'scope data';
    $scope.rp1 = $routeParams.rp1;
  }])

Following code works for me

  controller('MyCtrl1', function($scope, $routeParams) {
    $scope.mydata = 'scope data';
    $scope.rp1 = $routeParams.rp1;
  })

I'm new to AngularJS, so maybe there is another way to inject $scope in your sample? Please advise. Thanks you.

E2E test fails on browser().navigateTo('/')

When the site is served at root (/), the E2E test suite fails (it does not seem load the page).

How to reproduce

In test/e2e/scenarios.js, replace ../../app/index.html with /. Afterwards:

% cd app/
% python -m SimpleHTTPServer &
% cd ..
% ./scripts/e2e-test.sh 

Starting Testacular Server (http://vojtajina.github.com/testacular)
-------------------------------------------------------------------
info: Testacular server started at http://localhost:9876/
info (launcher): Starting browser Chrome
info (Chrome 24.0): Connected on socket id 7nsHwLjX-IG0g6j7L4nW
Chrome 24.0 my app view1 should render view1 when user navigates to /view1 FAILED
    element '[ng-view] p:first' text
    /Users/timdumol/devel/angular-seed/test/e2e/scenarios.js:25:14: Selector [ng-view] p:first did not match any elements.
Chrome 24.0: Executed 1 of 3 (1 FAILED)
info (Chrome 24.0): Connected on socket id QkSBGOq44N4EDLSFL4nX
info: Delaying execution, these browsers are not ready: Chrome 24.0
Chrome 24.0 my app view2 should render view2 when user navigates to /view2 FAILED
    element '[ng-view] p:first' text
    /Users/timdumol/devel/angular-seed/test/e2e/scenarios.js:40:14: Selector [ng-view] p:first did not match any elements.
Chrome 24.0: Executed 2 of 3 (2 FAILED)
info (Chrome 24.0): Connected on socket id L3XQjAzk1Xco7Ng9L4nY
info: Delaying execution, these browsers are not ready: Chrome 24.0
Chrome 24.0 ERROR
    Uncaught TypeError: Cannot read property 'name' of null
    at http://localhost:9876/adapter/angular-scenario.js?1350373484000:28
Chrome 24.0: Executed 2 of 3 (2 FAILED) ERROR (0.993 secs / 0.538 secs)
info: Disconnecting all browsers

(SimpleHTTPServer is used since it serves index.html instead of the directory listing when you access /)

Notes

If instead we replace ../../app/index.html with /index.html and do the above, the tests succeed. Similarly, if we replace ../../app/index.html with /app/ and run SimpleHTTPServer from angular-seed/, the tests succeed. Thus, it seems that it only fails when you try to navigate to /.

This happens both when using the latest stable version of Testacular, and testacular@canary.

Web Page errors

It would be nice if every web page included a link for users to report problems with the page, especially incorrect information and links. Having said that, this page:

https://github.com/angular/angular-seed

has the following problems:

For running end-to-end tests under Windows, it says:

script/e2e-test.bat

which is wrong on 2 counts - it's "scripts", not "script", and it should use back slashes

in addition, it would be nice if "clone the repo" were followed by a command line to do just that. Yeah, users of Git know exactly what that means, but new Git users would find it easier if the command line were right there.

Are changes between v0.9.19 and angular-seed (v1.0.0rc3) documented somewhere

Hello guys, I'm trying to start a new project based on the angular-seed, but it seems that a lot has changed since v0.9.19 which is documented at angularjs.org.

For example, there's no 'autobind' string in current version, and I didn't find any mention of how to start the autobinding in v1.0.0rc3, so all my views just sit dead without being bound to controllers.

Could you please give me some links to what changed, or some demo that works on current master?

Thanks!

Controllers shouldn't be global

Can I suggest that the controllers.js file is changed so that they are in a module.

var app = angular.module('myApp.controllers', []);

app.controller('MyCtrl1', [ function () {
}]);

app.controller('MyCtrl2', [ function () {
}]);

Travis Failure (Seems Karma Configuration is outdated)

Using worker: worker-linux-5-1.bb.travis-ci.org:travis-linux-13
git.1
$ git clone --depth=50 --branch=master git://github.com/ferronrsmith/angular-seed.git ferronrsmith/angular-seed
Cloning into 'ferronrsmith/angular-seed'...
remote: Counting objects: 676, done.
remote: Compressing objects: 100% (349/349), done.
remote: Total 676 (delta 367), reused 538 (delta 271)
Receiving objects: 100% (676/676), 4.82 MiB | 1.97 MiB/s, done.
Resolving deltas: 100% (367/367), done.
$ cd ferronrsmith/angular-seed
git.2
$ git checkout -qf e8c2480
$ nvm use 0.8
Now using node v0.8.25
$ node --version
v0.8.25
$ npm --version
1.2.30
before_script.1
$ export DISPLAY=:99.0
before_script.2
$ sh -e /etc/init.d/xvfb start
Starting virtual X frame buffer: Xvfb.
before_script.3
$ npm install --quiet -g karma
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No readme data.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No readme data.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.

[email protected] install /home/travis/.nvm/v0.8.25/lib/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
(node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory /home/travis/.nvm/v0.8.25/lib/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build' CXX(target) Release/obj.target/bufferutil/src/bufferutil.o SOLINK_MODULE(target) Release/obj.target/bufferutil.node SOLINK_MODULE(target) Release/obj.target/bufferutil.node: Finished COPY Release/bufferutil.node CXX(target) Release/obj.target/validation/src/validation.o SOLINK_MODULE(target) Release/obj.target/validation.node SOLINK_MODULE(target) Release/obj.target/validation.node: Finished COPY Release/validation.node make: Leaving directory/home/travis/.nvm/v0.8.25/lib/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'
/home/travis/.nvm/v0.8.25/bin/karma -> /home/travis/.nvm/v0.8.25/lib/node_modules/karma/bin/karma
[email protected] install /home/travis/.nvm/v0.8.25/lib/node_modules/karma-phantomjs-launcher/node_modules/phantomjs
node install.js
Writing location.js file
PhantomJS is already installed at /usr/local/phantomjs/bin/phantomjs.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
[email protected] /home/travis/.nvm/v0.8.25/lib/node_modules/karma-script-launcher
[email protected] /home/travis/.nvm/v0.8.25/lib/node_modules/karma-chrome-launcher
[email protected] /home/travis/.nvm/v0.8.25/lib/node_modules/karma-firefox-launcher
[email protected] /home/travis/.nvm/v0.8.25/lib/node_modules/karma-html2js-preprocessor
[email protected] /home/travis/.nvm/v0.8.25/lib/node_modules/karma-jasmine
[email protected] /home/travis/.nvm/v0.8.25/lib/node_modules/karma-requirejs
[email protected] /home/travis/.nvm/v0.8.25/lib/node_modules/karma-coffee-preprocessor
└── [email protected]
[email protected] /home/travis/.nvm/v0.8.25/lib/node_modules/karma-phantomjs-launcher
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
[email protected] /home/travis/.nvm/v0.8.25/lib/node_modules/karma
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])
before_script.4
$ ./scripts/web-server.js > /dev/null &
before_script.5
$ sleep 1
$ karma start config/karma.conf.js --no-auto-watch --single-run --reporters=dots --browsers=Firefox
WARN [config]: JASMINE is not supported anymore.
Please use frameworks = ["jasmine"]; instead.
WARN [config]: JASMINE_ADAPTER is not supported anymore.
Please use frameworks = ["jasmine"]; instead.
ERROR [config]: Config file must export a function!
module.exports = function(config) {
config.set({
// your config
});
};
The command "karma start config/karma.conf.js --no-auto-watch --single-run --reporters=dots --browsers=Firefox" exited with 1.
$ karma start config/karma-e2e.conf.js --reporters=dots --browsers=Firefox
WARN [config]: ANGULAR_SCENARIO is not supported anymore.
Please use frameworks = ["ng-scenario"]; instead.
WARN [config]: ANGULAR_SCENARIO_ADAPTER is not supported anymore.
Please use frameworks = ["ng-scenario"]; instead.
ERROR [config]: Config file must export a function!
module.exports = function(config) {
config.set({
// your config
});
};
The command "karma start config/karma-e2e.conf.js --reporters=dots --browsers=Firefox" exited with 1.
Done. Your build exited with 1.

Why the array brackets in the module().controller() call?

(Please redirect me to a more appropriate forum if this isn't the place for my question)

have started modifying angular-seed for my own purposes and quickly ran into a problem where I couldn't access the parameters in my controllers.

angular.module('myApp.controllers', []).
controller('MyCtrl1', [function($scope, myService) {
var myVar = myService.get(); // myService is undefined here

}])
.controller('MyCtrl2', [function() {

}]);

The problem went away when I removed the array brackets that surround the controller functions (the 2nd argument to angular.module().controller() calls). Why are those square brackets there? And is there a better way for me to access the parameters without removing the brackets?

This works:
angular.module('myApp.controllers', []).
controller('MyCtrl1', function($scope, myService) {
var myVar = myService.get(); // Now myService is defined here 💃

})
.controller('MyCtrl2', function() {

});

Unit testing improvement ideas...

I'm currently having fun with the tutorial and i got a few ideas :

  • Add a test/unit/runner.html so that unit tests can be run in the browser as well (not sure it can be done). I do like the console, but switching from the browser to the console can be annoying. And it would be better to have a single medium to test our apps.
  • Add color to the test.sh script output - that did probably add its share on why i'd rather have it in the browser.
  • Why not having a single runner.html that would run all tests?
  • I'm using liverload so test are re-run automatically this way, but looking at the tab title I can't know if the test passed/failed. Updating the <title> tag to reflect the test status would be great.

That's it for now.
Great tutorial by the way.

Feature Request - Add json supplied content to the partial sample pages.

The feature request:

Add json supplied content to the partial sample pages partial1.html and partial2.html

would be helpful for angular beginners such as myself. Just when I got excited about doing neat things with Angular, Groovy and Gradle using the Gradle Jetty Plugin (and was using groovlets to create JSON for a web UI) ... I read a better practice would be to use the angular-seed app as a starting template ... now it seems I have to start all over again to learn new secret handshakes to get back where I was.

I have not had much luck finding working examples of creating UI content from json based off of using angular-seed as a starting point (there are some jsfiddle and plunker examples but they don't seem to follow the angular-seed file and directory layout).

Hopefully the book market will jump on the Angular bandwagon soon and we will start to see plenty of Angular examples using angular-seed.

Update (next day): After learning more about angular (and a lot of trial and error) I did find a way to create content in the partial pages based on dynamic json from a groovlet ... but I seriously doubt I'm following best practices (much more to learn). The nice thing about using Gradle for any kind of web demo (including angular) is that it is probably one of the easiest ways to share a working web demo without requiring a user to install or configure anything (including gradle when using gradlew - the only catch is that it needs a Java JDK to be present which is extremely simple to install [1 click to download and a double click to start the installer and just use default options]).

rename partials to views

Why not to rename app/partials/partial1,2.html to app/views/view1,2.html?
Partials are IMO more similar to widgets/visual components.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.