Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

i have following code but my page does not show data...;( i don't now why please help me, i am new in angularjs. I AM calling web API its working fine console log show json record, but in my page record does now show... why

  <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script src="Scripts/angular.min.js"></script>
        <script>
  var app = angular.module('myApp', []);
    app.controller('customersCtrl', function($scope, $http) {
        $http.get("http://localhost:9000/employees").then(function (response) {
            $scope.myData = response.data;
        });
    });


    </script>
</head>
<body>
    <div ng-app="myApp" ng-controller="customersCtrl">
        <br>
       <p>Today's welcome message is:</p>
        <!--<h1>{{myWelcome}}</h1>-->
        <ul>
            <li ng-repeat="x in myData">
            <li ng-repeat="x in myData">
                {{ x.ProductName }} ',' {{ x.ProductDescription }}
            </li>
                <!--{{ x.ProductName + ', ' + x.ProductDescription }}-->
            </li>
        </ul>


    </div>

</body>
</html>

result = [{"ID":1,"ProductName":"xcxc","ProductDescription":"xcxc","UnitPrice":2323,"QtyAvailable":23}] its show below error in chrome console log

XMLHttpRequest cannot load http://localhost:9000/employees. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
154 views
Welcome To Ask or Share your Answers For Others

1 Answer

      <li ng-repeat="x in myData">
            {{ x.FirstName }} ',' {{ x.LastName }}
      </li>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...