Javascript 应用<;strong>;标记到my js.coffee文件中的字符串

Javascript 应用<;strong>;标记到my js.coffee文件中的字符串,javascript,ruby-on-rails,angularjs,ruby,slim-lang,Javascript,Ruby On Rails,Angularjs,Ruby,Slim Lang,我目前在RubyonRails项目中使用Angular和Slim。我的js.coffee中有一系列问题,目前正在我的视图中呈现 数组中的一个字符串具有强标记,但它在我的html中没有正确显示 我得到的不是标准的,而是 On which Playfield is the <strong>Standard</strong> game played ? 请尝试: (类似问题) 或者不知道是否可以使用ng bind html?ng bind html@凯拉斯我不熟悉你的建议。对

我目前在RubyonRails项目中使用Angular和Slim。我的js.coffee中有一系列问题,目前正在我的视图中呈现

数组中的一个字符串具有强标记,但它在我的html中没有正确显示

我得到的不是标准的,而是

On which Playfield is the <strong>Standard</strong> game played ?
请尝试: (类似问题)
或者

不知道是否可以使用ng bind html?ng bind html@凯拉斯我不熟悉你的建议。对这个相当陌生…你用的是angular 2吗?它是html视图吗?@Kailas我用字符串处理它,只是在数组中很难处理它。有什么想法吗?我已经更新了我的代码,当它是一个简单的字符串时,它就可以工作了。你知道我如何修复它以使用数组吗?你可以像使用简单字符串那样映射数组中的每个字符串。类似这样的内容:
$scope.stepQuestions=$scope.stepQuestions.map(项目)->$sce.trustAsHtml(项目)
您是否尝试将其放在括号内?你甚至可以这样说:
…Persona拥有这个游戏?'].map(项目)->$sce.trustAsHtml(项目)
我不确定。。。文档中写到:

,其中myHTML是一个范围变量。所以在你看来,你应该努力达到同样的结果。标记必须包含要绑定的变量的名称。甚至这也可能奏效:

。我现在不能测试它,所以我只是头脑风暴。我希望你能在这里找到一些有用的东西。女孩来帮忙!现在,您甚至可以清理代码并消除任何不必要的迭代(如map等)。这条线索出现在我起初没有注意到的视图中。祝你好运
game_create_ctrl.js.coffee

angular.module('OombangularApp').controller 'GameCreateCtrl', [
  '$scope', '$sce', '$uibModal', 'Game', 'GameFormat', 'PlayfieldType', 'Persona',
  ($scope, $sce, $uibModal, Game, GameFormat, PlayfieldType, Persona) ->

    $scope.step = 1

    ###This works...when it is not an Array
    $scope.html = "On which Playfield is the " + "<strong>Standard</strong>" + " game played ?"
    $scope.stepQuestion = $sce.trustAsHtml($scope.html)        

    ###How do I show the <strong> tags in my view when its an array?

    $scope.stepQuestions = ['What should this Game be called?', 'What should this Game be called?',
                        'What category does this Game belong to?',
                        'On which Playfield is the <strong>Standard</strong> game played ?',
                        'What is the Player Configuration?', 'How is a <strong>Standard</strong> game won?', 'Which Persona owns this Game?']

]

    $scope.stepQuestions = $scope.stepQuestions.map (item) -> $sce.trustAsHtml(item)
new.html.slim

form[name='gameCreateForm' ng-controller='GameCreateCtrl']

    ###This Works
    .question ng-bind-html="stepQuestion"{{ stepQuestion }}

    ###This doesnt
    .question ng-bind-html="stepQuestions"{{ stepQuestions[step - 1] }}