A client-side JS framework for adding interactivity to HTML.
How do we tell our HTML when to trigger our JS?
A directive is a marker on an HTML tag that tells Angular to run or reference some JS code. It's how we bind our HTML or behavior.
<table> | |
<tr ng-repeat="studio in studios | filter:status:true" > | |
<td>{{studio.name}}</td> | |
<td>{{studio.status}}</td> | |
</tr> | |
</table> |
<select ng-model="status" ng-options="profile.status as profile.status for profile in profiles | unique:'status'" > | |
<option value="">All</option> | |
</select> | |
<select ng-model="city" ng-options="profile.city as profile.city for profile in profiles | unique:'city'" > | |
<option value="">All</option> | |
</select> | |
<table> | |
... |
.highlight { background-color: #49483e } | |
.c { color: #75715e } /* Comment */ | |
.err { color: #960050; background-color: #1e0010 } /* Error */ | |
.k { color: #66d9ef } /* Keyword */ | |
.l { color: #ae81ff } /* Literal */ | |
.n { color: #f8f8f2 } /* Name */ | |
.o { color: #f92672 } /* Operator */ | |
.p { color: #f8f8f2 } /* Punctuation */ | |
.cm { color: #75715e } /* Comment.Multiline */ | |
.cp { color: #75715e } /* Comment.Preproc */ |
.highlight { | |
background-color: #efefef; | |
padding: 7px 7px 7px 10px; | |
border: 1px solid #ddd; | |
-moz-box-shadow: 3px 3px rgba(0,0,0,0.1); | |
-webkit-box-shadow: 3px 3px rgba(0,0,0,0.1); | |
box-shadow: 3px 3px rgba(0,0,0,0.1); | |
margin: 20px 0 20px 0; | |
overflow: hidden; |
class Employee | |
include ActiveSupport::Configurable | |
end | |
employee = Employee.new | |
employee.config.research_lab_entry = :not_allowed | |
employee.config.paid_leave = 5 | |
class Employee | |
include ActiveSupport::Configurable |
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
# hirb / test / test_helper.rb | |
require 'bacon' | |
require 'bacon/bits' | |
require 'mocha-on-bacon' | |
require 'hirb' | |
include Hirb | |
module TestHelpers | |
# set these to avoid invoking stty multiple times which doubles test suite running time |