我想使用密码js在角2加密password.Can任何人都告诉我如何在webpack中添加密码js插件。我对this.Please一无所知,请帮帮我。
发布于 2018-04-06 17:14:57
这是答案,这可能会给你一些线索。然而,这是对角(角1)。这就是我的app.js的样子。
var jquery = require('jquery');
<other requires>
var CryptoJS = require('crypto-js');
var appRequires = [ngRoute, ngCookies, ngChart];
var app = angular.module('myModule', appRequires)
.config{...}; (hidden config goes here)
// connect controllers services filters
require('./services/couchdbService')(app);
<other controllers and services>
require('./controllers/authCtrl')(app, CryptoJS);Nota,上面我是如何将CryptoJS传递给authCtrl模块的。现在让我们研究一下我的authCtrl:
module.exports = function(myModule, CryptoJS) {
myModule.controller('authCtrl',[
'$scope', '$http', '$routeParams', 'WebappService',
function ($scope, $http, $routeParams, WebappService) {
HERE GOES CONTROLLER BUSINESS LOGIC
console.log(CryptoJS.SHA256('Taras Vaskiv'));
}]);
}老实说,我很难把webpack用在天使身上。听起来不那么容易。
https://stackoverflow.com/questions/40945349
复制相似问题