I'm new in AngularJS, and can't do the simple task. I hope that you will help me. My goal is to display the $scope property "server" from controller to text input in the view when it's loaded:
My controller:
(function () {
'use strict';
angular
.module('app')
.controller('HomeController', homeController);
homeController.$inject = ['authService', 'httpService'];
function homeController(authService, $scope) {
var vm = this;
vm.auth = authService;
$scope.server = SERVER_HOST_NAME;
console.log ($scope.server);
}
})();
var SERVER_HOST_NAME = "anysite.com"; is global.
And I want, that the text input in the view is display that for loading.
My view is
<h4 ng-if="vm.auth.isAuthenticated()">
You are logged in!
</h4>
<h4 ng-if="!vm.auth.isAuthenticated()">
You are not logged in! Please <a ng-click="vm.auth.login()">Log In</a> to continue.
</h4>
<div class="container">
<label>Team city server:</label>
<input ng-model="server" type="text" />
<button ng-click="getBuilds()">Extract</button>
</div>
I use ng-model to bind my property to textinput, but have no idea why it is not working. I guess this is simple task. Thank you.