Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them, it only takes a minute:

This is my controller Symfony :

$em = $this->getDoctrine()->getManager();
$advert = $em->getRepository('OCPlatformBundle:Advert')->find($id);
if ($advert == null) {
  throw $this->createNotFoundException("L'annonce d'id ".$id." n'existe pas.");
}
      $em->remove($advert);
      $em->flush();

      $request->getSession()->getFlashBag()->add('notice', 'Annonce bien enregistrée.');

      return $this->redirect($this->generateUrl('oc_platform_view', array('id' => $advert->getId())));
    }


  }

and in twig

{% for advert in adverts %}
        <li>{{ advert.name|e }}</li>
<a href="{{ path('delete_route_name', {'id': advert.id }) }}">Delete</a>
    {% endfor %}

Please help, I dont know how to make angularJs to show modal confirmation for delete action and refresh my view page

share|improve this question
    
Hi and welcome to stackoverflow. You should start formatting your code properly (indentation etc...) to make it more readable for yourself and others – wmk Oct 21 at 19:41
    
please read the how to ask guide – inaliahgle Oct 22 at 8:30

1 Answer 1

You can do it in javascript:

<a href="javascript:void(0)" onclick="if(confirm('Are you sure?')){window.location='{{ path('delete_route_name', {'id': advert.id }) }}';}">delete</a>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.