I used yeoman angular generator to scaffold my app, and now I'm working on a specific view.
I'm building a simple ng-repeat function, in order to clean up my html and avoid repeating the same markup 4 times.
I am making content panels, and want to add a class specific to the content, so I can style it with Sass. I tried using ng-class but so far I've been unable to make it work.
I am new to AngularJS, I tried reading the official ng-class documentation and this writeup but so far I'm unable to make it work. I guess it just takes a while to get used to Angular.
here's my view:
<div data-ng-controller="LandingController">
<div ng-repeat="panel in panels">
<div class="panel-heading">
{{ panel.title }}
</div>
<div class="panel-content" ng-class="{{panel.contentClass}}" data-ng-bind-html="panel.content">
</div>
</div>
</div>
and the controller:
'use strict';
angular.module('angularApp')
.controller('LandingController', function ($scope) {
$scope.panels = [
{
title: 'lokacija',
contentClass: 'location',
content:'<p>Institut Jožef Stefan<br>Jamova 30<br>1000 Ljubljana</p><br><div class="map-container"></div>'
},
{
title: 'kontakt',
contentClass: 'location',
content: ''
},
{
title: 'delovni čas',
contentClass: 'location',
content: ''
},
{
title: 'katalog',
contentClass: 'location',
content: ''
}
];
});