layout: post title: Angular JS intro tag: [blog] —
I am assuming there are multiple frameworks Angular can be installed into, in my case it is a Rails framework. Here are the steps to installing Rails (sorry everyone else)
Go to https://angularjs.org/ and download the uncompressed angular.js file.
Get rid of the turbolinks line in that file, which can cause problems down the road.
Add the following content to it: https://gist.github.com/jaywengrow/96b28f375e4235b5a70b
Back to the application.js: Below require angular, add //=require app (It must be below require angular so Angular can be loaded first.)
Add to your HTML. If your browser shows the number 2, congratulations you have angular!: https://gist.github.com/jaywengrow/3e1e2deb0865cd0cca96
Create your Angular Controller
Note the differences
Each variable or function begins with $scope.(insert name)
Referring to variables or functions only requires the name of the function without $scope
Functions are called in div tags
Instead of the <%=beehive%> tag for ruby code, we use
The each loop is written in the div tag differently than in ruby.
array.each do |element| puts element end
<div ng-repeat="elements in array"> </div>
BUT MOST OF ALL…
The biggest difference in my opinion is that you can make functions happen with a click or mouse-over! With angular you can bring your functions to life by adding them to a tag. I hope this helps you all create more interactive applications! Stay tuned.