ng-repeat issue creating a table

Hi:

I am not able to create a table from ng-repeat data:

<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.\
js"></script>
<body>

<div ng-app="myApp" ng-controller="myCtrl">

<script>
var app = angular.module('myApp',[]);
app.contoller('myCtrl', function($scope){

$scope.flights=[
{no:'DL 123', from:'SFO', to:'DEN', starttime:'7 AM', reaching:'9 AM' Duration:\
'2h', price:'100 dollars'},
{no:'UA 123', from:'SFO', to:'DEN', starttime:'7 AM', reaching:'9 AM' Duration:\
'2h', price:'100 dollars'},
{no:'VX 123', from:'SFO', to:'DEN' starttime:'7 AM', reaching:'9 AM' Duration:'\
2h', price:'100 dollars'}
];
}
</script>

<table ng-show="myVar" ng-controller="myCtrl">
  <tr ng-repeat="x in flights">
    <td>{{x.no}}</td>
    <td>{{x.from}}</td>
    <td>{{x.to}}</td>
    <td>{{x.starttime}}</td>
    <td>{{x.reaching}}</td>
    <td>{{x.Duration}}</td>
    <td>{{x.price}}</td>
  </tr>
</table>
</body>
</html>

Open in new window


Look forward to your comments.

Best Regards

Sunnybrad
sunnybradAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jan LouwerensSoftware EngineerCommented:
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body ng-app="myApp">

<table ng-controller="myCtrl">
<tr ng-repeat="x in flights">
  <td>{{x.no}}</td>
  <td>{{x.from}}</td>
  <td>{{x.to}}</td>
  <td>{{x.starttime}}</td>
  <td>{{x.reaching}}</td>
  <td>{{x.Duration}}</td>
  <td>{{x.price}}</td>
  <td>{{x.Name}}</td>
  <td>{{x.Country}}</td>
</tr>
</table>

<script>
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
  $scope.flights = [
    {no:'DL 123', from:'SFO', to:'DEN', starttime:'7 AM', reaching:'9 AM', Duration:'2h', price:'100 dollars'},
    {no:'UA 123', from:'SFO', to:'DEN', starttime:'7 AM', reaching:'9 AM', Duration:'2h', price:'100 dollars'},
    {no:'VX 123', from:'SFO', to:'DEN', starttime:'7 AM', reaching:'9 AM', Duration:'2h', price:'100 dollars'}
  ]
});
</script>

</body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.