Angularjs将值与jstl进行比较

问题描述:

我使用angularjs在不同页面上的控制器之间传递值。这是我app.js的一部分。



I'm passing values between controllers on different pages using angularjs. This is a part of my app.js.

app.controller('JewelleryCtrl', function($scope, srvShareData) {
      $scope.sharedData = srvShareData.getData();
      sessionStorage.clear();
    });





我可以在下一页获得通过的值





and i'm able to get the passed values in the next page

<pre>

{{sharedData}}



在我的情况下,此{{sharedData}}包含值Rings。我想在jstl中比较这个值,但它不起作用。



我尝试过:



这就是我正在尝试的,



{{sharedData}}

in my case this {{sharedData}} contains the value "Rings". i want to compare this value in jstl but it is not working.

What I have tried:

this is what i'm trying,

<div ng-controller="JewelleryCtrl" class="ui-tabs-panel ui-tabs-hide ui-widget-content ui-corner-bottom" id="fragment-2">


    <%    
        String subcat1 = "{{sharedData}}";
        request.setAttribute("subcat", subcat1);
    %>

    <!--<h4>Address</h4>-->
<div class="sell" onsubmit="return false">
     <c:set var="subcategory" value="${subcat}" scope="session"/>
    <c:out value="${subcategory}"></c:out>
    <c:choose>
        <c:when test="${subcategory == 'Rings'}">
    <div class="col-3">
        <label>
            <select id="basemodel" name="sizeofring" tabindex="5">
                <option value="" selected="">Select Ring Size</option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
             </select>
        </label></c:when> 
        </c:choose> 
    </div>





此比较始终失败。我是否已将{{sharedData}}转换为字符串并进行比较?我不知道该怎么做。任何帮助表示赞赏..



提前致谢..



This comparison always fails. Do i have convert the {{sharedData}} to string and compare? I dont know how to do it. Any help is appreciated..

Thanks in advance..

scope,srvShareData){
scope, srvShareData) {


scope.sharedData = srvShareData.getData();
sessionStorage.clear();
});
scope.sharedData = srvShareData.getData(); sessionStorage.clear(); });





我可以在下一页获得传递的值





and i'm able to get the passed values in the next page

<pre>

{{sharedData}}



in my case {{sharedData}}包含值Rings。我想在jstl中比较这个值,但它不起作用。



我尝试过:



这就是我正在尝试的,



{{sharedData}}

in my case this {{sharedData}} contains the value "Rings". i want to compare this value in jstl but it is not working.

What I have tried:

this is what i'm trying,

<div ng-controller="JewelleryCtrl" class="ui-tabs-panel ui-tabs-hide ui-widget-content ui-corner-bottom" id="fragment-2">


    <%    
        String subcat1 = "{{sharedData}}";
        request.setAttribute("subcat", subcat1);
    %>

    <!--<h4>Address</h4>-->
<div class="sell" onsubmit="return false">
     <c:set var="subcategory" value="


{subcat}scope =session/>
< c:out value =
{subcat}" scope="session"/> <c:out value="