私は MEAN.JS を使用していますが、このコードが何をするのか正確にはわかりません。
ファイル:
public/modules/users/services/authentication.client.service.js
コード:
'use strict';
// Authentication service for user variables
angular.module('users').factory('Authentication', [
function() {
var _this = this;
_this._data = {
user: window.user
};
return _this._data;
}
]);
「this」のコピーを作成し、プロパティを追加してから、次のようなことをする代わりにそのプロパティを返すのはなぜですか:
'use strict';
// Authentication service for user variables
angular.module('users').factory('Authentication', [
function() {
return {
user: window.user
};
}
]);