JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="myApp" ng-controller="merchantListController">
<div ng-show="message">
<h2>show</h2>
</div>
<div ng-hide="!message">
<h2>Hide</h2>
</div>
</div>
JavaScript
function merchantService($http) {
function post() {
return $http.get('localhost');
//Just a dummy $http request, instead of yours.
//return $http.post(global.base_url + '/merchant/list');
}
return {
post: post
};
}
function merchantListController($scope, merchantService) {
$scope.message = false;
merchantService.post()
.then(function (response) {
console.log(response);
$scope.merchants = response.data;
$scope.message = true;
})
.then(function (error) {
console.error(error);
});
}
var app = angular.module('myApp', []);
app.controller('merchantListController', merchantListController);
app.factory('merchantService', merchantService);