Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/456.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法在angularjs中使用ngstyle动态创建边框_Javascript_Angularjs_Angularjs Digest - Fatal编程技术网

Javascript 无法在angularjs中使用ngstyle动态创建边框

Javascript 无法在angularjs中使用ngstyle动态创建边框,javascript,angularjs,angularjs-digest,Javascript,Angularjs,Angularjs Digest,我在元素上应用了此条件,但它没有显示任何边框,也没有显示解析html时的任何错误: <h1 ng-style="'{border:' + f()+'px' + 'solid red'+'}'">{{a}}</h1> 您的代码基本上是正确的,只有小问题与'的位置。请尝试下列方法 <h1 ng-style="{'border': f() + 'px solid red'}">{{a}}</h1> {{a} <h1 ng-style="{'

我在元素上应用了此条件,但它没有显示任何边框,也没有显示解析html时的任何错误:

<h1 ng-style="'{border:' + f()+'px' + 'solid red'+'}'">{{a}}</h1>

您的代码基本上是正确的,只有小问题与'的位置。请尝试下列方法

<h1 ng-style="{'border': f() + 'px solid red'}">{{a}}</h1>
{{a}

<h1 ng-style="{'border': f() + 'px solid red'}">{{a}}</h1>