You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by Mark Nolan <ma...@gmail.com> on 2019/06/18 18:14:31 UTC

AngularJS issue upgrading authentication provider from 0.9.14 to 1.0.0

I am getting multiple parse errors from AngularJS. I know 1.0.0 upgraded
AngularJS and I'm off to look through the notes now, but if anyone knows
what causes this, you could save me a lot of time!

Everything I know about AngularJS I have learned by looking at what
Guacamole does or through writing this extension. I do have a lot of
experience with Angular, so I am somewhat familiar with the concepts. I
don't really have any decent development tools for AngularJS, however, so
everything is a little opaque. Plus, I think it is fairly difficult to
bootstrap a test environment that looks like Guacamole ;)

The authentication provider adds start and stop buttons and a status
indicator. The service itself links these to GCP to start and stop the VMs.
This panel of controls appears to the left of each connection in the list
of connections. The panel does display, but it isn't doing anything on
click (not even erroring).

The browser console shows this:

angular.js:14800 Error: [$parse:syntax]
http://errors.angularjs.org/1.6.9/$parse/syntax?p0=%7B&p1=invalid%20key&p2=17&p3=xxxAuthGcpStop(%7B%7Bitem.identifier%7D%7D)&p4=%7Bitem.identifier%7D%7D
)
    at angular.js:88
    at q.throwError (angular.js:15358)
    at q.object (angular.js:15347)
    at q.primary (angular.js:15236)
    at q.unary (angular.js:15224)
    at q.multiplicative (angular.js:15211)
    at q.additive (angular.js:15202)
    at q.relational (angular.js:15193)
    at q.equality (angular.js:15184)
    at q.logicalAND (angular.js:15176) "<svg id="xxx-stop" width="100%"
height="100%" viewBox="0 0 16 24" fit="" focusable="false" xmlns="
http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet"
class="xxx-icon xxx-enabled"
ng-click="xxxAuthGcpStop({{item.identifier}})">"

The actual template is huge, so I am reluctant to include the whole thing
here, but this is an excerpt:

<span class="xxx-status"><!-- Because of the way this is compiled, it
*must* have just one root element --><span
class="xxx-menu" ng-if="item.identifier && canManageConnection"
><!-- Lots of stuff missed out here for the status indicator (big
ng-switch) --><!-- SVG here for the start button --><svg
id="xxx-stop" width="100%" height="100%" viewBox="0 0 16 24" fit=""
focusable="false"
xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet"
class="xxx-icon xxx-enabled" ng-click="xxxAuthGcpStop({{item.identifier}})">
<path d="M2 6h12v12H2z" fill-rule="evenodd" />
<title>Stop Instance</title>
</svg></span></span>


And it is part of a directive that is used like this:

<meta name="before" content=".home-connection">
<xxx-auth-gcp item="item"></xxx-auth-gcp>

My initial guess was that 1.0.0 changed the use of item.identifier, as that
is what the error message suggested to me, but they have reasonable values
in the document when I look through developer tools. The next most likely
option is that it cannot find the method that is bound to the ng-click.
Unless I find something else, that is my next avenue of investigation.

Thanks,
Mark.
.

Re: AngularJS issue upgrading authentication provider from 0.9.14 to 1.0.0

Posted by Mark Nolan <ma...@gmail.com>.
Perfect!

I was actually quite happy with the interpolation binding (fixing the
identifier on each line) and had no idea it wasn't allowed!

Many thanks,
M.
.


On Tue, 18 Jun 2019 at 19:45, Mike Jumper <mj...@apache.org> wrote:

> On Tue, Jun 18, 2019 at 11:14 AM Mark Nolan <ma...@gmail.com> wrote:
>
> > ...
> > The browser console shows this:
> >
> > angular.js:14800 Error: [$parse:syntax]
> >
> >
> http://errors.angularjs.org/1.6.9/$parse/syntax?p0=%7B&p1=invalid%20key&p2=17&p3=xxxAuthGcpStop(%7B%7Bitem.identifier%7D%7D)&p4=%7Bitem.identifier%7D%7D
> > )
> >     at angular.js:88
> >     at q.throwError (angular.js:15358)
> >     at q.object (angular.js:15347)
> >     at q.primary (angular.js:15236)
> >     at q.unary (angular.js:15224)
> >     at q.multiplicative (angular.js:15211)
> >     at q.additive (angular.js:15202)
> >     at q.relational (angular.js:15193)
> >     at q.equality (angular.js:15184)
> >     at q.logicalAND (angular.js:15176) "<svg id="xxx-stop" width="100%"
> > height="100%" viewBox="0 0 16 24" fit="" focusable="false" xmlns="
> > http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet"
> > class="xxx-icon xxx-enabled"
> > ng-click="xxxAuthGcpStop({{item.identifier}})">"
> >
>
> Did you mean:
>
> ng-click="xxxAuthGcpStop(item.identifier)"
>
> ?
>
> For AngularJS, depending on the directive, you'll find things like
> some-attribute="{{ angular expression }}" and some-attribute="angular
> expression". The ngClick directive is one of the latter. The double braces
> introduce an angular expression, when necessary, but are not valid syntax
> _within_ an angular expression.
>
> - Mike
>

Re: AngularJS issue upgrading authentication provider from 0.9.14 to 1.0.0

Posted by Mike Jumper <mj...@apache.org>.
On Tue, Jun 18, 2019 at 11:14 AM Mark Nolan <ma...@gmail.com> wrote:

> ...
> The browser console shows this:
>
> angular.js:14800 Error: [$parse:syntax]
>
> http://errors.angularjs.org/1.6.9/$parse/syntax?p0=%7B&p1=invalid%20key&p2=17&p3=xxxAuthGcpStop(%7B%7Bitem.identifier%7D%7D)&p4=%7Bitem.identifier%7D%7D
> )
>     at angular.js:88
>     at q.throwError (angular.js:15358)
>     at q.object (angular.js:15347)
>     at q.primary (angular.js:15236)
>     at q.unary (angular.js:15224)
>     at q.multiplicative (angular.js:15211)
>     at q.additive (angular.js:15202)
>     at q.relational (angular.js:15193)
>     at q.equality (angular.js:15184)
>     at q.logicalAND (angular.js:15176) "<svg id="xxx-stop" width="100%"
> height="100%" viewBox="0 0 16 24" fit="" focusable="false" xmlns="
> http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet"
> class="xxx-icon xxx-enabled"
> ng-click="xxxAuthGcpStop({{item.identifier}})">"
>

Did you mean:

ng-click="xxxAuthGcpStop(item.identifier)"

?

For AngularJS, depending on the directive, you'll find things like
some-attribute="{{ angular expression }}" and some-attribute="angular
expression". The ngClick directive is one of the latter. The double braces
introduce an angular expression, when necessary, but are not valid syntax
_within_ an angular expression.

- Mike