Avatar of quest_capital
quest_capital

asked on 

Angular expressions will not show if $http is called.

I have a expressions that will not show if $http is called:

Controller
function StaysCtrl($scope, $http, $state, Idle, notify, AuthSrv, appResource) {

    // Will not show up if I make a $http call
    this.helloText = 'Welcome to Stays';

    //appResource.query(function (data) {
    //    $scope.stays = data;
    //});

    // If I comment out this $http call the helloText will show up.
    $http({
        method: 'GET',
        dataType: 'json',
        headers: {
            "Content-Type": "application/json"
        },
        url: 'http://localhost:6060/api/stay/10/desc',
        data: JSON.stringify(),
    }).success(function (data) {
        $scope.stays = data;
    });
    
}

Open in new window


HTML
<div ng-controller="StaysCtrl as stays" class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="text-center m-t-lg">
                <h1>
                    {{stays.helloText}}
                </h1>
                <small>Configure in config.js as minor state.</small>
            </div>
        </div>
    </div>

    <div ng-repeat="stay in stays">
        <div>{{stay.stayID}}</div>
    </div>
</div>

Open in new window


What am I missing?
HTMLAngular.NET Programming

Avatar of undefined
Last Comment
Julian Hansen
SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of Avodah
Avodah
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo