-
-
Save ajtowf/13523e4b89b254b4ea7f to your computer and use it in GitHub Desktop.
AngularJS ng-cloak example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.splash { | |
display: none; | |
} | |
[ng-cloak].splash { | |
display: block !important; | |
} | |
.splash { | |
position: absolute; | |
top: 0; | |
left: 0; | |
height:100%; | |
width:100%; | |
filter: alpha(opacity=60); | |
opacity: 0.6; | |
background: #000; | |
} | |
.splash h2 { | |
text-align: center; | |
font-size: 4em; | |
color:white; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="splash" ng-cloak=""> | |
<h2>Loading</h2> | |
</div> | |
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script> | |
<div ng-controller="mainController" ng-cloak=""> | |
Name <input ng-model="name"/> | |
<br/><br/> | |
{{greeting}} {{name}} | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var app = angular.module("myApp", []); | |
app.controller("mainController", ["$scope", function($scope) { | |
$scope.greeting = "Hello"; | |
$scope.name = "world"; | |
}]); | |
var body = document.getElementsByTagName('body')[0]; | |
setTimeout(function() { | |
body.setAttribute('ng-app', 'myApp'); | |
angular.bootstrap(body, ['ng', 'myApp']); | |
}, 2000); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment