将现有的Angular2 RC2应用升级到RC4需要哪些步骤?我已经更新了我的package.json文件(见下文),并在根文件夹上运行了npm update,但它仍然引用RC2中node modules文件夹中的旧版本角度包。
我检查了更改日志和发布说明并搜索了谷歌但无济于事。应用程序运行但在引用与RC2无效的新ngModel相关表单功能时崩溃。我试图更新到RC4以使用新的表单模块来查看是否能解决我的基础表单问题。
原始
"dependencies": {
"@angular/common": "2.0.0-rc.2",
"@angular/compiler": "2.0.0-rc.2",
"@angular/core": "2.0.0-rc.2",
"@angular/forms": "0.1.0",
"@angular/http": "2.0.0-rc.2",
"@angular/platform-browser": "2.0.0-rc.2",
"@angular/platform-browser-dynamic": "2.0.0-rc.2",
"@angular/router": "3.0.0-alpha.7",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.2",
修饰
"dependencies": {
"@angular/common": "2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@angular/forms": "0.2.0",
"@angular/http": "2.0.0-rc.4",
"@angular/platform-browser": "2.0.0-rc.4",
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
"@angular/router": "3.0.0-beta.1",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.4",
答案 0 :(得分:3)
您可以在项目目录中执行override func viewDidLoad() {
super.viewDidLoad()
username = tempUser.username
self.resultSearchController = ({
let controller = UISearchController(searchResultsController: nil)
controller.searchResultsUpdater = self
controller.dimsBackgroundDuringPresentation = false
controller.searchBar.sizeToFit()
self.tableView.tableHeaderView = controller.searchBar
return controller
})()
get{(value) in
self.values = value
for ele in self.values{
if self.username != ele["username"] as! String{
}
}
}
self.tableView.reloadData()
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(serviceBoard.methodhandlingTheNotificationEvent), name:"NotificationIdentifier", object: nil)
}
func methodhandlingTheNotificationEvent(){
tableView.reloadData()
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if (self.resultSearchController.active && resultSearchController.searchBar.text != "") {
return self.filteredTableData.count
}
else {
return values.count
}
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as!postCell
let maindata = values[values.count-1-indexPath.row]
if (self.resultSearchController.active && resultSearchController.searchBar.text != "") {
// if (filteredTableData[indexPath.row].rangeOfString("###") == nil){
cell.postImg.image = UIImage(named:"tile_services")
cell.title.text = filteredTableData[indexPath.row]
cell.category.text = "SERVICES"
var price = String()
for i in values{
if (i["title"] as? String)! == filteredTableData[indexPath.row]{
price = (i["price"] as? String)!
cell.categories = "Services"
cell.username = i["username"] as! String
cell.prices = i["price"] as! String
cell.notes = i["notes"] as! String
cell.school = i["school"] as! String
}
}
cell.price.text = price
return cell
}
else {
if maindata["username"] as! String != username && username != "admin"{
cell.deleteBtn.hidden = true
}
else{
cell.categories = "Services"
cell.username = maindata["username"] as! String
cell.prices = maindata["price"] as! String
cell.notes = maindata["notes"] as! String
cell.school = maindata["school"] as! String
}
cell.postImg.image = UIImage(named:"tile_services")
cell.title.text = maindata["title"] as? String
cell.category.text = "SERVICES"
cell.price.text = maindata["price"] as? String
return cell
}
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let popOverVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("showPostT") as! showPostT
self.addChildViewController(popOverVC)
popOverVC.view.frame = self.view.frame
self.view.addSubview(popOverVC.view)
popOverVC.didMoveToParentViewController(self)
if (self.resultSearchController.active && resultSearchController.searchBar.text != "") {
for i in values{
if (i["title"] as? String)! == filteredTableData[indexPath.row]{
popOverVC.type.text = "SERVICE"
popOverVC.typeImg.image = UIImage(named:"tile_services")
popOverVC.item.text = "Service: \(i["title"] as! String)"
popOverVC.price.text = "Price: \(i["price"] as! String)"
popOverVC.notes.text = "Notes: \(i["notes"] as! String)"
popOverVC.comments.text = i["comments"] as? String
popOverVC.postUser.text = i["username"] as! String
popOverVC.notesStr = i["notes"] as! String
popOverVC.category = "service"
popOverVC.pricesStr = i["price"] as! String
if username == popOverVC.postUser.text!{
popOverVC.composeBtn.hidden = true
}
}
}
}
else{
let maindata = values[values.count-1-indexPath.row]
popOverVC.type.text = "SERVICE"
popOverVC.typeImg.image = UIImage(named:"tile_services")
popOverVC.item.text = "Service: \(maindata["title"] as! String)"
popOverVC.price.text = "Price: \(maindata["price"] as! String)"
popOverVC.notes.text = "Notes: \(maindata["notes"] as! String)"
popOverVC.comments.text = maindata["comments"] as? String
popOverVC.postUser.text = maindata["username"] as! String
popOverVC.notesStr = maindata["notes"] as! String
popOverVC.category = "service"
popOverVC.pricesStr = maindata["price"] as! String
if username == popOverVC.postUser.text!{
popOverVC.composeBtn.hidden = true
}
}
}
而不是更新吗?