小编rob*_*rob的帖子

SWIFT 3 - 从JSON web url中取出的字符串中取出html标签

我想知道如何从Web网址中删除JSON中的HTML标记.我是否必须使用NSString类似的东西.

所以我想要去掉汇总值中的html标签.我查看了abit,它说NSString可以使用,但我不确定这是否可以在Swift 3中实现.任何帮助将不胜感激.

我的代码:

import UIKit
import Alamofire

struct postinput {
    let mainImage : UIImage!
    let name : String!
    let author : String!
    let summary : String!

}


class TableViewController: UITableViewController {

    var postsinput = [postinput]()

    var mainURL = "https://www.example.com/api"

    typealias JSONstandard = [String : AnyObject]

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        callAlamo(url: mainURL)
    }

    func callAlamo(url : String){
        Alamofire.request(url).responseJSON(completionHandler: {
            response in

            self.parseData(JSONData: response.data!)


        }) …
Run Code Online (Sandbox Code Playgroud)

html json ios swift swift3

9
推荐指数
1
解决办法
8846
查看次数

如何将图像添加到 Angular Material 表列中?

我正在使用 Angular Material 表。我想在该列中的标志文本之前有一个图标,或者如何添加带有图标的列?出于某种原因,我不知道如何做到这一点。到目前为止我的代码是:

组件.ts

export interface PeriodicElement {
  date: string;
  action: string;
  mileage: string;
  author: string;
  flag: string;
}

  const ELEMENT_DATA: PeriodicElement[] = [
  {date: 'xxxxx', action: 'xxxxx', mileage: "xxxxx", author:"xxxxx", flag:"Late"},
  {date: 'xxxxx', action: 'xxxxx', mileage: "xxxxx", author:"xxxxx", flag:"Late"},
  {date: 'xxxxx', action: 'xxxxx', mileage: "xxxxx", author:"xxxxx", flag:"Late"},
];

  displayedColumns: string[] = ['date', 'action', 'mileage', 'author', 'flag'];
  dataSource = new MatTableDataSource(ELEMENT_DATA);
Run Code Online (Sandbox Code Playgroud)

HTML

<ng-container matColumnDef="flag">
        <th mat-header-cell *matHeaderCellDef mat-sort-header> Flag</th>
        <td mat-cell *matCellDef="let element" class="status">{{element.flag}} </td>
</ng-container>
Run Code Online (Sandbox Code Playgroud)

angular-material angular

4
推荐指数
1
解决办法
5430
查看次数

Angular 6 构建无法加载资源

我正在尝试使用该命令构建我的应用程序,ng build --prod但是当我尝试加载文件dist夹中的 index.html 文件时,出现以下错误:

styles.76a1111….css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
runtime.06daa30….js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
polyfills.f6ae3e8….js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
scripts.f11023c….js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
main.4ee5dbf….js:1 Failed to load resource: the server responded with a status …
Run Code Online (Sandbox Code Playgroud)

build angular

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

angular ×2

angular-material ×1

build ×1

html ×1

ios ×1

json ×1

swift ×1

swift3 ×1