angular1アプリケーションを非同期にブートストラップする方法については、excellent articleがあります。これにより、ブートストラッピングする前にサーバからjsonを取得することができます。Angular 2アプリケーションを非同期にブートストラップする方法
メインコードはここにある:
(function() {
var myApplication = angular.module("myApplication", []);
fetchData().then(bootstrapApplication);
function fetchData() {
var initInjector = angular.injector(["ng"]);
var $http = initInjector.get("$http");
return $http.get("/path/to/data.json").then(function(response) {
myApplication.constant("config", response.data);
}, function(errorResponse) {
// Handle error case
});
}
function bootstrapApplication() {
angular.element(document).ready(function() {
angular.bootstrap(document, ["myApplication"]);
});
}
}());
私は、角2と同じことを達成するにはどうすればよいですか?
同様です。 。 。 –
私はちょうど角度クライアントに手動でhttp2を取得する方法を見てみましょうか? –
'新しいInjector([HTTP_PROVIDERS])。get(Http)'のようなもの –