Redirecting to Url with additional custom data in AngularDart


A list of name is populated and while click on that name it redirects to google search. I need help in adding a custom populated data name to the url through html which will redirect the visitor with an auto searched result of Google search.



    <h2>My favorite hero is: {{}}</h2>



       <li *ngFor="let hero of heroes">

             <a href="">{{ }}</a>




     import 'package:angular2/angular2.dart';
     import 'src/hero.dart';

      selector: 'my-app', 
      template: '''app_component.html''', 

      directives: const [CORE_DIRECTIVES], )

      class AppComponent {
            String title = 'Tour of Heroes';
            List<Hero> heroes = [
              new Hero(1, 'Windstorm'),
              new Hero(13, 'Bombasto'),
              new Hero(15, 'Magneta'),
              new Hero(20, 'Tornado')
      Hero get myHero => heroes.first;


Same way as you bind your data to HTML, you can bind it do HTML attribute, eg. this should work.

<a href="{{ }}">{{ }}</a>

By the way, you should consider to add the target="_blank" attribute to the link as well, so the user will open the search in a new tab and your app will still be going on.

Answered By – tenhobi

Answer Checked By – David Goodson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *