i have this controller and this view (html). if i give an initial value to $scope.article.Context, it will be shown in the view. (means that the view recognizes the controller). when i change the $scope.article.Context value inside a controller function, i dont see it changing in the view. any idea ? Thanks !!!
controller:
angular.module('generalApp', [])
.controller('menuController', function ($scope, $http) {
$scope.article = {Context:"initial value"} ;
$scope.menuLinkSelected = function (articleId) {
$http.post("Home/GetArticle?articleId=" + articleId).then(function (response) {
$scope.article.Context = "new value";
$scope.$apply();
});
};
html:
<body ng-app="generalApp">
<div ng-controller="menuController">
<div ng-include="'partials/topMenu.html'"></div>
<div ng-include="'partials/sideMenu.html'"></div>
<div ng-model="article">
<label>{{article.Context}}</label>
</div>
<input type="button" value="click" onclick="ziba()" />
</div>