Variable appearing as html - IONIC FRAMEWORK

Asked

Viewed 1,278 times

0

I’m starting at Ionic, I followed this tutorial, all right until then, however, when I go to index.html and put the variable {{firstname}}, in the browser it shows as if it were going through html, unlike it is written {{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>

3 answers

1

There may be some error in connection with your data file, the "store" of your application, in which case it would be important to show us how you are doing the inclusion of 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;
        })

0

Solved guys,

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

exampleApp = angular.module('Starter', ['Ionic', 'Starter.controllers'])

Vlw =D

0

Following 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!!!!!!");

      })
    }
  });

Browser other questions tagged

You are not signed in. Login or sign up in order to post.