Add the following to your CSS:
[ng\:cloak],[ng-cloak],.ng-cloak{display:none !important}
Compiling your angular templates is not fast enough.
UPDATE
You should not manipulate the DOM in the controller. There are two things you can do ... 1. You can intercept changes in value within the scope of the controller through the directive! In your case, create a directive as an attribute that is assigned the property that you want to see. In your case, it will be caseData . If casedata is false, hide it. Otherwise, show it.
- The easiest way is to use ngShow = 'casedata'.
the code
var myApp = angular.module('myApp', []); myApp.controller("caseCtrl", function ($scope, $http, $routeParams, $timeout) { $scope.caseData = null; //mimic a delay in getting the data from $http $timeout(function () { $scope.caseData = 'hey!'; }, 1000); }) .directive('showHide', function () { return { link: function (scope, element, attributes, controller) { scope.$watch(attributes.showHide, function (v) { if (v) { element.show(); } else { element.hide(); } }); } }; });
HTML
<div ng-controller='caseCtrl' show-hide='caseData'>using directive</div> <div ng-controller='caseCtrl' ng-show='caseData'>using ngShow</div>
JSFIDDLE: http://jsfiddle.net/mac1175/zzwBS/
mitch Aug 08 '13 at 18:28 2013-08-08 18:28
source share