Click to load image

Description

The following code shows how to Click to load image.

Example


<!DOCTYPE html>
<html  ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script type='text/javascript'>
function ShowHideController($scope) {<!--   ww  w  .  j av a  2s. c o m-->
    $scope.showImage = function(){
        $scope.images = ['http://www.java2s.com/style/download.png'];
    }
}
</script>
</head>
<body>
  <div ng-app ng:controller="ShowHideController">
    <div ng-repeat='image in images'>
        <img ng-src="{{image}}"/>
    </div>
    <button ng-click='showImage()'> show image </button>
<div>
</body>
</html>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities