我看了一下教程里,都是在template設置了ng-model,我想如果model不設置,單純的修改scope內部值,頁面顯示不刷新,為何?varmyMod=angular('myMod',[])myMod.controller('ctl',function($scope){$scope.hello='hello'}).directive('drc',function(){return{link:function(scope,elem,attr){elem.click(function(){scope.hello="www"})}}}){{hello}}click這樣的話,我試下來click內部的scope.hello會改變,但是這個改變不會影響到外層hello的展現。好像link內部的scope只是外層$scope的一份拷貝。請問我該如何實現我想要的這個功能?
angular 指令內部事件如何改變外層scope值?
拉莫斯之舞
2019-04-14 09:52:23