Angularjs将值与jstl进行比较 [英] Angularjs value comparison issue with jstl

查看:373
本文介绍了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="


这篇关于Angularjs将值与jstl进行比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆