0
以下は、角型アプリケーションの外観です。ページロードで角度サービスでページの読み込み時に関数を呼び出す方法
(function() {
"use strict";
angular
.module("app.core", ['ngRoute']);
}());
サービス
(function() {
'use strict';
angular
.module('app.service')
.factory('dataService', dataService);
dataService.$inject = ['$http', '$q'];
function dataService($http, $q) {
var service = {
create: create,
read: read,
update: update,
remove: remove
}
return service;
function read() {
return
$http.get("APIURL")
.then(success)
.catch(exception);
function success(response) {
}
function exception(ex) {
}
}
function create() {}
function update() {}
function detete() {}
}
})`
index.htmlを
<body ng-app="app.core">
<div ng-view> </div>
</div>
、家庭template.htmlはNG-ビューに挿入されています。
(のみのDataServiceの読み取りを呼び出すための正しい方法であるもの
以下には何の手がかり)ページ 負荷の?
[ページロードの呼び出し機能上のAngularjs]の可能な重複(https://stackoverflow.com/questions/27194805/angularjs-on-page-load-call-function) –