国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術(shù)文章
文章詳情頁

angular.js - angular指令通過"="不能獲取數(shù)據(jù)

瀏覽:85日期:2024-10-09 13:52:30

問題描述

也不能說不能獲取,但是不知道出了什么問題, scope 可以看到, 但是通過屬性訪問卻訪問不到

具體看下面代碼和圖片

html 中

<ul widget-paginate='vm.activities'></ul>

directive.js 中

var directive = { scope:{paginate : ’=widgetPaginate’ }, link : link}function link(scope, ele, attrs){ console.log(scope); console.log('---------directive---------'); console.log(scope.paginate.data); console.log('---------directive---------');}

angular.js - angular指令通過"="不能獲取數(shù)據(jù)

angular.js - angular指令通過"="不能獲取數(shù)據(jù)

angular.js - angular指令通過"="不能獲取數(shù)據(jù)

問題解答

回答1:

var directive = { scope:{paginate : ’=widgetPaginate’ }, link : link}function link(scope, ele, attrs){ console.log(scope); console.log('---------directive---------'); $timeout(console.log(scope.paginate.data));//這樣應(yīng)該能取得的。 console.log('---------directive---------');}

因為數(shù)據(jù)的異步問題

回答2:

你這個數(shù)據(jù)是從后臺獲取的吧。使用$watch監(jiān)聽一下,你就知道了,我也認(rèn)為是異步的問題。

相關(guān)文章:
主站蜘蛛池模板: 湖口县| 太谷县| 河间市| 泸州市| 开鲁县| 县级市| 泰顺县| 昌都县| 鄂温| 平山县| 虹口区| 渭源县| 云安县| 阜南县| 资中县| 绿春县| 孝义市| 九龙县| 晋城| 巩留县| 鄂尔多斯市| 东辽县| 资兴市| 眉山市| 新宁县| 江源县| 南皮县| 金阳县| 玉环县| 彰化县| 九寨沟县| 肥东县| 石河子市| 广饶县| 来安县| 江达县| 射洪县| 龙里县| 青川县| 嵩明县| 舟曲县|