angular-ujs

angular-ujs

Distributed via

Version

Unobtrusive scripting for AngularJS ( without jQuery dependency )

Travis CI   Quality     Coverage    Dependencies

Project philosophy

Develop in LiveScript

LiveScript is a compile-to-js language, which provides us more robust way to write JavaScript.
It also has great readibility and lots of syntax sugar just like you're writting python/ruby.

Native, lightweight directives

Unobtrusive scripting in jquery_ujs provides the same interface with angular directives.
We use the similarity between them and provides seamless intergration with jquery_ujs.

Spec / Scenario coverage

We use krama to run unit test against angular-ujs.spec.ls and use protractor to run intergration test via angular-ujs.scenario.ls.

Installation

We follow DRY and has one dependency only on angularjs.
However, we recommend you add ng-rails-csrf into your project. As it name suggests, ng-rails-csrf automatically resolves CSRF in angularjs environment without jquery_ujs.

Just use it

Then include them through script tag in your HTML.

Rails projects (Only support 3.1+)

Add this line to your application's Gemfile:

And then execute:

Then add these lines to the top of your app/assets/javascripts/application.js file:

And include in your angular module definition:

Usage

"data-confirm": Confirmation dialogs for links and forms

"data-method": Links that result in POST, PUT, or DELETE requests

"data-remote": Make links and forms submit asynchronously with Ajax

** Notice : API changed **

For angularjs apps, ONLY those items with ng-model will be submitted with data-remote

You can specify the model name via data-remote :

Use them all together :

Contributing

devDependency Status

  1. Fork it ( https://github.com/tomchentw/angular-ujs/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
comments powered by Disqus
This page was last updated over 3 years ago.