angularjs 引用圖片

  • 180
  • 0

用<img  src="">會出現錯誤訊息,必須用<img  ng-src="">才不會有錯誤訊息

<script src="~/Scripts/ngcontroller.js"></script>
<div ng-app="myModule">
    <div ng-controller="myController">
    
        Picture:<img ng-src="{{ employee.Pic }}" />
        
    </div>

</div>

var myApp = angular.module("myModule", []);

myApp.controller("myController", function ($scope) {
    var employee = {
        
        Pic:"../Images/girl.jpg"
    };


    $scope.employee = employee;
});