I'm trying to implement some angularjs into my Rails application.
I've done the following, and Angular is running (I typed angular into dev console) but not rendering/executing my angular code in my HAML file.
a. Added angular to my gemfile:
source 'https://rails-assets.org'
gem "rails-assets-angular"
group :development, :test do
gem 'rails-assets-angular-mocks'
end
b. Added //= require angular and //= require angular/admin/adminApp (my Angular App file) to app/assets/javascripts/application.js
c. Enabled Angular by adding %html{ 'ng-app' => true } to the tag in the layout app/views/layouts/application.html.haml
d. Added an adminApp:
adminApp = angular.module('adminApp', ['ngResource'])
e. Added and adminController:
'use strict';
angular.module('adminApp')
.controller('AdminCtrl', function ($scope, $http) {
$scope.test = "This is working!"
});
f. Added the following to one of my app's index.html.haml:
UPDATE: changed haml so that angular elements are inside the ng-controller div
%div{"ng-controller" => "AdminCtrl"}
{{test}}
%p Hello {{"World" + "!"}}
Upon loading that page, I get the non-angularized output:
{{test}} Hello {{"World" + "!"}}
From everything I've read, it should be working. Just not sure where I've gone wrong. Have I missed anything?
{{test}}is not within your%div{"ng-controller" => "AdminCtrl"}