Javascript calling function without needing .click

1

How can I call this function without having to create a button, for example:

My controller sends a notification for the {{error}} html or {{success}} and both are hidden and I want to customize this information before it is displayed

<div class="content" ng-controller="respostasController">
    <div class="alert alert-danger" ng-show="error" class="ng-hide">
        <span>{{error}} </span>
            <button class="close" type="button" ng-click="close()">x</button>
    </div>,
    <div class="alert alert-success" ng-show="success" class="ng-hide">
        <span>{{success}} </span>
            <button class="close" type="button" ng-click="close()">x</button>
    </div>
</div>

I want to get this information {{error}} and {{success}} and customize it in the script below before displaying on the page

$('#clique').click(function(){

        $.bootstrapGrowl("div 1",{
            allow_dismiss: false,
            type: 'danger'
        });

        $.bootstrapGrowl("div 2",{
            allow_dismiss: false,
            type: 'success'
        });
    });
    
asked by anonymous 11.10.2016 / 22:14

1 answer

0

From what I understand, you're using angular to render the page. In this case, you can directly change the variable in $scope . The change is applied directly to the screen, without the click event. You can still set the value of this variable at controller initialization.

Example

link

    
11.10.2016 / 23:01