Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Newline in ionicpopup content

Is it possible to have a newline character in ionicpopup content?

I am trying to do this:

  $ionicPopup.alert({
                  title: 'Now what?',
                  content: "To start receiving messages: \n"
                           + "        - Open the side menu (button on top left) \n"
                           + "   - Tap 'Add Organisations' \n"
                           + "   - Browse the list of organisations available \n" 
                           + "or \n"
                           + "   - Enter a Passphrase to join a private group. \n \n"
                           + "Once you've subscribed to an organisation, you'll start receiving messages from them.",
                  buttons: [
                            { text: "Don't show me again" },
                            {
                              text: 'Okay',
                              type: 'button-positive'
                            }
                          ]
                }).then(function(res) {
                  if(res) {
                        console.log('You are sure');
                  } else {
                    console.log('You are not sure');
                  }
            });

My newline characters are not working. I see the content in the popup as one long paragraph without new lines.

Is this possible?

like image 308
lulu88 Avatar asked Jun 25 '14 07:06

lulu88


1 Answers

Yes it is possible to have newline character in ionic popup content.

Replace \n with < br > tag and it works. The ionic framework outputs HTML after execution of that javascript. It also works with html string single quotation string.

like image 114
Arjun Upadhyay Avatar answered Oct 22 '22 16:10

Arjun Upadhyay