edit: Ich bin mit Bootstrap, denke ich Bootstrap Tab verursacht das Problem
Ansicht nicht nach $ scope Variable Update aktualisiert.
$ scope.codeData
wenn ich die $ scope.codeData trösten, ich die Daten sehen können, aber machen nicht in Sicht.
Ich muss zweimal klicken, um die Ansicht korrekt zu rendern.
ist irgendetwas mit meinem Code falsch?
Vielen Dank.
Config
angular.module('SPAroutes', ['ngRoute', 'SPAcontrollers', 'SPAdirectives'])
.config(['$routeProvider', '$locationProvider',
function($routeProvider, $locationProvider) {
$routeProvider
.when('/admin', {
templateUrl: 'templates/views/admin.html',
controller: 'adminCtrl',
controllerAs: 'admin'
})
$locationProvider.html5Mode(true).hashPrefix('!');
}]);
Controller.js
angular.module('SPAcontrollers', ['ngRoute', 'SPAfactories', 'SPAdirectives']).controller('adminCtrl', ['$scope', '$http', '$location', '$window', '$SPAaccount', function ($scope, $http, $location, $window, $SPAaccount) {
this.dataRetrive = function(category){
$http.get('/ctrls/get/blockCode/header').then(function (res){
$scope.codeData = res.data;
console.log($scope.codeData);
$('#headerTab').tab('show');
}, function (err){
console.log(err);
})
};
}]);
admin.html
{{codeData}}
$ Umfang gelten $() wird die Arbeit tun.. Aber es sollte nicht benötigt werden. – atinder
@atinder nein, das ist ganz sicher nicht die Antwort – Phil
Wann/wo rufst du 'dataRetrieve()'? Sie scheinen auch '$ scope' mit' controllerAs' zu mischen, was normalerweise nicht das ist, was Sie wollen. – Phil