如何使用angular js?
从存储在json文件中的URL获取/显示外部媒体内容JSON
"media": [
{
"title": "Example_1",
"url": "http://www.w3schools.com/html/mov_bbb.mp4"
},
…….
]
控制器
controller('Controller', ['$scope','$http', function($scope, $http) {
$http.get('myjson.json').success(function (data){
$scope.medianew = data.media;
});
HTML
<div class="panel-body" ng-repeat = "md in medianew">
<video ng-src="{{md.url}}" width="240" controls></video>
</div>
我无法显示外部来源的媒体。我在这里做错了什么?
答案 0 :(得分:1)
您的问题与此one.
有些相似您需要使用角度来看import UIKit
import Charts
class CombinedChartsTest: UIViewController {
@IBOutlet weak var combinedChart: CombinedChartView!
let months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
let unitsSold = [2.0, 4.0, 6.0, 3.0, 12.0, 16.0, 4.0, 17.0, 2.0, 4.0, 5.0, 4.0]
override func viewDidLoad() {
super.viewDidLoad()
setChart(months, yValuesLineChart: unitsSold, yValuesBarChart: unitsSold)
}
func setChart(xValues: [String], yValuesLineChart: [Double], yValuesBarChart: [Double]) {
combinedChart.noDataText = "Please provide data for the chart."
var yVals1 : [ChartDataEntry] = [ChartDataEntry]()
var yVals2 : [BarChartDataEntry] = [BarChartDataEntry]()
for i in 0..<xValues.count {
yVals1.append(ChartDataEntry(value: yValuesLineChart[i], xIndex: i))
yVals2.append(BarChartDataEntry(value: yValuesBarChart[i] - 1, xIndex: i))
}
let lineChartSet = LineChartDataSet(yVals: yVals1, label: "Line Data")
let barChartSet: BarChartDataSet = BarChartDataSet(yVals: yVals2, label: "Bar Data")
let data: CombinedChartData = CombinedChartData(xVals: xValues, dataSets: [lineChartSet,barChartSet])
combinedChart.data = data
}
}
服务。我做了一个plnkr来解决你的问题。
$sce
答案 1 :(得分:0)
基本上,您需要将myfns () {
local fun
declare -F |
while read -r _ _ fun; do
case :$SYSFNS: in *:"$fun":*) continue;; esac
echo "$fun"
done
}
文件的内容解析为json
内容。
json