Reputation: 4811
I cant seem to get the image to show up. How exactly would I write this to get it in my html from my controller using angular.js? I am using a ui-router also
The title shows up, but not the image.
Controller:
angular
.module('app')
.controller('aboutCtrl', ['$scope', function($scope){
$scope.title = "About",
$scope.image = "images/myimage.jpg";
}]);
HTML:
<h3 class="center">{{title}}</h3>
<figure class="image">
<img ng-src="{{image}}" >
</figure>
Upvotes: 0
Views: 715
Reputation: 55443
I think you haven't passed reference of controller. try this.
<div ng-app="app" ng-controller="aboutCtrl">
<h3 class="center">{{title}}</h3>
<figure class="image">
<img ng-src="{{image}}" >
</figure>
<div>
Upvotes: 1