Created
April 28, 2015 16:14
-
-
Save takashi/59d2b570f7474340e1b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('moduleName') | |
| .controller('TestController', function($scope) { | |
| $scope.onFileSet = function(file) { | |
| var reader = new FileReader(); | |
| reader.onload = function(e) { | |
| $scope.$apply(function() { | |
| $scope.article.thumbnail.url = e.target.result; | |
| }); | |
| } | |
| reader.readAsDataURL(file) | |
| } | |
| }) | |
| // <div ng-controller="TestController" > | |
| // <img ng-src="{{article.thumbnail.url}}" alt="" width="125px" height="125px" ng-if="article.thumbnail.url.length"> | |
| // </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment