AngularJS: 'Template for directive must have exactly one root element' when using 'th' tag in directive template

1304 단어
.controller('HomeController', function($scope,$location) {
    $scope.userName=' , !';
    $scope.clkUrl=function(){
        $scope.pageUrl='norout1.html';// 
    }
    $scope.clk2=function(){
       alert($scope.userName);
        $scope.userName=' '
    }
}).directive('bhtml',function(){
    return {
templateUrl:'norout1.html',
restrict:'E',
replace:true

}
})
<div ng-controller="HomeController as homeP"> <p> :<bhtml></bhtml></p> </div>  norout1.html: <p> <pre><button ng-click="clk2()" > </button> <input type="text" ng-model="userName"/> </pre> </p>

replace:true AngularJS: 'Template for directive must have exactly one root element' when using 'th' tag in directive template
false。

좋은 웹페이지 즐겨찾기