How to call a Facebook page from a NativeScript app

How to call a Facebook page inside the Facebook app from NativeScript

  •         
    import {Component, OnInit} from '@angular/core';
    var utilityModule = require("utils/utils");
    
    @Component({
      moduleId: module.id,
      selector: 'gf-main-ihm',
      templateUrl: 'main-ihm.html'
    })
    export class MainComponent {
      
      	constructor() {}
    
    	followUs(){
    	      var installed = utilityModule.openUrl("fb://page/303192086777956");
        	      if (!installed) {
                    //if facebook app is not installed
              		utilityModule.openUrl("https://facebook.com/EidWa7deh/");
          		  }
    		}
    	}
            
        

  •         
    <ActionBar android.icon="res://icon" 
               android.iconVisibility="always" 
               class="action-bar">
        <ActionItem (tap)="followUs()">
                <Button class="btn btn-active font-awesome" text="&#xf09a;" >
          		</Button>
          </ActionItem>
     </ActionBar>
    <StackLayout>
                    
    </StackLayout>
            
        

  • How to call a Facebook page from inside the Facebook app from NativeScript: By using openUrl method that exists in the utils/utils package. We pass the link as ("fb://") and this will launch the facebook app, if it exists. To direct the link to a certain page we should pass the Page_Id of the Facebook page.