Variable appearing as html - IONIC FRAMEWORK

0

I'm starting on Ionic, I followed this tutorial , everything However, when I go to index.html and put the variable {{firstname}}, it shows in the browser as if it were going through html, unlike it after writing {{firstname}} and not the date of the array.

  <ion-content ng-controller="StudyingController">
  <button class="button" ng-click="getData()">Test</button>
  <br>
  name: {{firstname}} {{lastname}}
  </ion-content>
    
asked by anonymous 02.04.2015 / 23:00

3 answers

1

There may be some error in the connection to your data store, the "store" of your application, in which case it would be important to show us how you are including your data file as it is in the application you are following as an example:

$http.get("http://localhost/example.json", { params: { "key1": "value1", "key2": "value2" } })
        .success(function(data) {
            $scope.firstname = data.firstname;
            $scope.lastname = data.lastname;
        })
    
03.04.2015 / 16:52
0

Resolved galley,

The problem is that I did not use it as follows:

exampleApp = angular.module ('starter', ['ionic', 'starter.controllers'])

Vlw = D

    
15.04.2015 / 22:39
0

Next form:

exampleApp.controller("StudyingController", function($scope, $http){

  $scope.getData = function(){
    $http.get("http://echo.jsontest.com/firstname/Nic/lastname/Raboy/state/California", { params: {"key1": "value", "key2": "value2"}})
      .success(function(data) {
        $scope.firstname = data.firstname;
        $scope.lastname = data.lastname;
      })
      .error(function(data) {
        alert("PAAAAMM!!!!!!");

      })
    }
  });
    
03.04.2015 / 20:20