Last active
December 2, 2016 20:19
-
-
Save mpolci/52db63980897bcd19d77778045b20743 to your computer and use it in GitHub Desktop.
Revisions
-
mpolci renamed this gist
Sep 6, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
mpolci revised this gist
Sep 6, 2016 . No changes.There are no files selected for viewing
-
mpolci revised this gist
Sep 6, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -26,4 +26,4 @@ Looks at the code below: ``` Notice that there is no `ng-app` directive, the bootstrap is delegated to the small script in the body section. Notice also the `ng-cloack` directive, it avoids the rendering of the raw page template. -
mpolci created this gist
Sep 6, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ Truffle since release 2.0.8 delays the initialization of the global variable `web3` after the load event, so this variable is not available during angular bootstrap, inside a .config() section, inside providers and neither inside the controllers initialized at load time and related injected services. Accessing to the web3 variable inside a setTimeout() call could be a solution for simple projects but the only way to be sure that web3 is initialized is to postpone the angular bootstrap. Looks at the code below: ```html <!DOCTYPE html> <html> <head> ... </head> <body ng-cloak> ... <script> window.addEventListener('load', function() { angular.bootstrap(document, ['sampleApp']) }) </script> </body> </html> ``` Notice that there is no `ng-app` directive, the bootstrap is delegated to the small script in the body section. Notice also the ng-cloack directive, it avoids the rendering of the raw page template.