详情.js
(function() {
var module = angular.module('app.main', []);
function config($stateProvider) {
$stateProvider.state('app.main.detail', {
url: 'detail',
views: {
'detail@': {
templateUrl: 'app/main/detail.html',
controller: 'DetailController as vm'
}
}
})
}
module.config(config);
})();
在main.js
中//: Playground - noun: a place where people can play
import Foundation
func convertToHex(base64 base64String: String) -> String {
let data = NSData(base64Encoded: base64String)!
return data.description
}
func convertToBase64(hex hexString: String) -> String {
let data = NSData(data: hexString.data(using: .utf8)!)
return data.base64EncodedString()
}
print(convertToHex(base64: "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t"))
// <49276d20 6b696c6c 696e6720 796f7572 20627261 696e206c 696b6520 6120706f 69736f6e 6f757320 6d757368 726f6f6d> (Correct - this is the argument in the assigned function below)
print(convertToBase64(hex: "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"))
// NDkyNzZkMjA2YjY5NmM2YzY5NmU2NzIwNzk2Zjc1NzIyMDYyNzI2MTY5NmUyMDZjNjk2YjY1MjA2MTIwNzA2ZjY5NzM2ZjZlNmY3NTczMjA2ZDc1NzM2ODcyNmY2ZjZk (Incorrect - supposed to match the argument in the function above)
如何将detail.js控制器拆分为子控制器?因为我有超过1000行代码。谢谢