I am currently working on creating a "single client" view for my application. Each client has a first name (prenom) and a last name (nom). However, even though my application recognizes that these values exist for each client, they do not appear on the screen.
My main question is: Why are the data values not appearing?
This is the URL I have for the localhost: LOCALHOST/#/clients/-JYvLztvmRIcT8ITKWl1
For an updated version: click to see live code here: http://plnkr.co/edit/0waQY6ny8TvgNZhz4DRW?p=preview
HTML
<p>Client: {{client}}</p>
<p>Clients: {{clients}}</p>
<p>Client.prenom: {{client.prenom}}</p>
Generated HTML (whenever the page gets loaded)
Client: [{},{}]
Clients:
Client.prenom:
Controller (app.js code snippet)
app.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/', {
templateUrl: 'accueil.html'
}).
when('/clients', {
templateUrl: 'clients.html',
controller: 'ClientsCtrl'
}).
when('/clients/:clientId', {
templateUrl: 'client.html',
controller: 'ClientSoloCtrl'
}).
otherwise({
redirectTo: '/'
});
}]);
app.controller('ClientSoloCtrl', ClientSoloCtrl);
function ClientSoloCtrl ($scope, $firebase, $routeParams) {
var clientId = $routeParams.clientId;
var ref = new Firebase("https://crmfirebase.firebaseio.com/clients/"+clientId);
$scope.client = $firebase(ref).$asArray();
$scope.removeClient = function(client) {
$scope.client.$remove(client);
};
$scope.addClient = function (client) {
$scope.client.$add(client);
};
$scope.updateClient = function (client) {
$scope.client.$save(client);
};
}