ng-show="my.message" は http 成功で true に設定されていますが、ビューは更新されません。
これが私のコードです:
コントローラ J:
lgControllers.controller('FormCtrl', function($scope, $http) {
$scope.my = {
message: false
};
$scope.submitForm = function() {
$http({
url: "../saket/ajax.php",
data: "email_id=" + $scope.form.emailaddress + "&category_id=" + cat_num + "&action=subscribe",
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
}).success(function(data) {
$scope.my = {
message: true
};
console.log(data); // http is success
console.log($scope.my.message); // gives true
}).error(function(err) {
"ERR", console.log(err)
})
};
});
インデックス.html:
<div ng-controller="FormCtrl">
<div ng-show="my.message">It worked!</div>
</div>
my.message はコンソールで true になりますが、div はビューで非表示のままです。
問題がどこにあるのかわかりません。