I'm trying something in angularjs. This is the controller I made:
function ImagesController($scope){
$scope.count = 0;
$scope.imags = [
{
image1: 'images/levels/level1/sky.jpg',
image2: 'images/levels/level1/rain.jpg',
image3: 'images/levels/level1/sky.jpg'
},
{
image1: 'images/levels/level2/x.jpg',
image2: 'images/levels/level2/y.jpg',
image3: 'images/levels/level2/z.jpg'
}
];
}
And this is the HTML linking to this controller:
<div ng-controller="ImagesController">
Random Writing
<img ng-src="$scope.imags[0].image1">
</div>
I don't know why the image that I'm trying to display is not working. I have added ng-app to the tag already so that can't be the issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.