I want to convert AngularJS http.get this code into TypeScript for Ionic2


For this output I need to convert following code into TypeScript

ServiceModel.all().then(function(result) {
    vm.data = result.data.data;

this is html content

        <div id="row_d" class="row" ng-repeat="object in vm.data">
          <div class="col">{{object.train_name}}</div>
          <div class="col">{{object.departure_fort}}</div>
          <div class="col">{{object.arrival_destination}}</div>
          <div class="col">{{object.departure_destination}}</div>    
          <div class="col">{{object.arrival_fort}}</div>


I would recommend starting with the Angular2 documentation.


I checked but I need to put http.get result into a object and show it using *ngFor. like which I did in ionic1 using AngularJs


The code you posted is not a self-contained island. It is part of a larger application. You are going to have to reimplement (and preferably rearchitect) the rest of it. Until you have a fundamental understanding of how Angular2 works, that is going to be flat impossible. You are asking the equivalent of “where is the turn signal on this airplane?” when you don’t know how to fly yet.


thank you for your reply. I learn angular2 and I done this yesterday night.