通过Angular Script添加URL

时间:2016-07-26 10:54:46

标签: javascript angularjs

如何为标题添加网址? URL应该可以在HTML页面上访问,任何人都可以在我的情况下指定我应该如何使用$ sce.trustAsHtml

        var trustedHtml = [];
        var calEvents = [];
        var eventSources = [];

        for (var int = 0; int < json1.length; int++) {

            $scope.html = '<a href="#">' + json1[int].comment + '</a>';

            $scope.eventSources = $sce.trustAsHtml($scope.html);
            console.log(eventSources);
            alert(eventSources);
            var d = new Date(json1[int].reminderDate);

            calEvents.push(
            {
                title: json1[int].comment,// I want to add url to title
                start: d,
                allDay: true
            }
             //console.log(calEvents)
        );
        }

1 个答案:

答案 0 :(得分:0)

使用text measure text

ng-bind-html