使用angularjs定义html中的属性ng-attr-(suffix)

html中的属性很多,同样可以使用angularjs来定义:

ng-attr-(suffix)=只能使用变量定义
<div title="angularjs中的title">title</div>
<div ng-attr-title="angularjs中的title">title</div><!--这样写显示不出来标题-->
<div ng-attr-title="'angularjs中的title'">title</div><!--这样写显示不出来标题-->
<div ng-attr-title="{{titleStr}}">title</div><!--只能使用变量定义-->
angular.module('myApp',[])
     .controller('myCtrl',['$scope',function($scope){
              $scope.titleStr = "angularjs中的title";
      }]);

ng-bind中使用字符可以将文字显示出来

<span ng-bind="  'angularjs中的title'   ";
原文地址:https://www.cnblogs.com/loveamyforever/p/6086381.html